diff --git a/docs.json b/docs.json
index 1f311f94e6..cb59c361c1 100644
--- a/docs.json
+++ b/docs.json
@@ -991,14 +991,6 @@
"pages": [
"weave/reference/python-sdk/trace_server_bindings/remote_http_trace_server"
]
- },
- {
- "group": "Other",
- "pages": [
- "weave/reference/python-sdk/weave/trace/op",
- "weave/reference/python-sdk/weave/trace/weave_client",
- "weave/reference/python-sdk/weave/trace_server/trace_server_interface"
- ]
}
]
},
@@ -1030,6 +1022,7 @@
"weave/reference/typescript-sdk/functions/requirecurrentchildsummary",
"weave/reference/typescript-sdk/functions/weaveaudio",
"weave/reference/typescript-sdk/functions/weaveimage",
+ "weave/reference/typescript-sdk/functions/withattributes",
"weave/reference/typescript-sdk/functions/wrapopenai"
]
},
@@ -1098,7 +1091,9 @@
"inference/usage-limits",
{
"group": "Tutorials",
- "pages": ["inference/tutorials/creating-lora"]
+ "pages": [
+ "inference/tutorials/creating-lora"
+ ]
},
{
"group": "API Reference",
@@ -2625,4 +2620,4 @@
}
],
"baseUrl": "https://docs.wandb.ai"
-}
+}
\ No newline at end of file
diff --git a/weave/reference/python-sdk.mdx b/weave/reference/python-sdk.mdx
index 2949788cdf..d5804006ac 100644
--- a/weave/reference/python-sdk.mdx
+++ b/weave/reference/python-sdk.mdx
@@ -3,280 +3,1578 @@ title: "weave"
description: "Python SDK reference for weave"
---
+import { SourceLink } from '/snippets/en/_includes/source-link.mdx';
+
# API Overview
---
-
+
+
+## class `Agent`
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `model_name`: ``
+- `temperature`: ``
+- `system_message`: ``
+- `tools`: `list[typing.Any]`
+
+
+
+### method `step`
+
+```python
+step(state: AgentState) → AgentState
+```
+
+Run a step of the agent.
+
+**Args:**
+
+
+ - `state` : The current state of the environment.
+ - `action` : The action to take.
+**Returns:**
+ The new state of the environment.
+
+---
+
+
+
+## class `AgentState`
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `history`: `list[typing.Any]`
+
+---
+
+
+
+## class `AnnotationSpec`
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `field_schema`: `dict[str, typing.Any]`
+- `unique_among_creators`: ``
+- `op_scope`: `list[str] | None`
+
+
+
+### classmethod `preprocess_field_schema`
+
+```python
+preprocess_field_schema(data: dict[str, Any]) → dict[str, Any]
+```
+
+---
+
+
+
+### classmethod `validate_field_schema`
+
+```python
+validate_field_schema(schema: dict[str, Any]) → dict[str, Any]
+```
+
+---
+
+
+
+### method `value_is_valid`
+
+```python
+value_is_valid(payload: Any) → bool
+```
+
+Validates a payload against this annotation spec's schema.
+
+**Args:**
+
+
+ - `payload` : The data to validate against the schema
+**Returns:**
+
+ - `bool` : True if validation succeeds, False otherwise
+
+---
+
+
+
+## class `Audio`
+A class representing audio data in a supported format (wav or mp3).
+
+This class handles audio data storage and provides methods for loading from different sources and exporting to files.
+
+**Attributes:**
+
+ - `format` : The audio format (currently supports 'wav' or 'mp3')
+ - `data` : The raw audio data as bytes
+
+**Args:**
+
+
+ - `data` : The audio data (bytes or base64 encoded string)
+ - `format` : The audio format ('wav' or 'mp3')
+ - `validate_base64` : Whether to attempt base64 decoding of the input data
+**Raises:**
+
+ - `ValueError` : If audio data is empty or format is not supported
+
+
+
+### method `__init__`
+
+```python
+__init__(
+ data: 'bytes',
+ format: 'SUPPORTED_FORMATS_TYPE',
+ validate_base64: 'bool' = True
+) → None
+```
+
+---
+
+
+
+### method `export`
+
+```python
+export(path: 'str | bytes | Path | PathLike') → None
+```
+
+Export audio data to a file.
+
+**Args:**
+
+
+---
+
+
+
+### classmethod `from_data`
+
+```python
+from_data(data: 'str | bytes', format: 'str') → Self
+```
+
+Create an Audio object from raw data and specified format.
+
+ - `path` : Path where the audio file should be written
+**Args:**
+
+
+ - `data` : Audio data as bytes or base64 encoded string
+ - `format` : Audio format ('wav' or 'mp3')
+**Returns:**
+
+ - `Audio` : A new Audio instance
+
+**Raises:**
+
+ - `ValueError` : If format is not supported
+
+---
+
+
+
+### classmethod `from_path`
+
+```python
+from_path(path: 'str | bytes | Path | PathLike') → Self
+```
+
+Create an Audio object from a file path.
+
+**Args:**
+
+
+ - `path` : Path to an audio file (must have .wav or .mp3 extension)
+**Returns:**
+
+ - `Audio` : A new Audio instance loaded from the file
+
+**Raises:**
+
+ - `ValueError` : If file doesn't exist or has unsupported extension
+
+---
+
+
+
+## class `Content`
+A class to represent content from various sources, resolving them to a unified byte-oriented representation with associated metadata.
+
+This class must be instantiated using one of its classmethods:
+- from_path()
+- from_bytes()
+- from_text()
+- from_url()
+- from_base64()
+- from_data_url()
+
+
+
+### method `__init__`
+
+```python
+__init__(*args: 'Any', **kwargs: 'Any') → None
+```
+
+Direct initialization is disabled. Please use a classmethod like `Content.from_path()` to create an instance.
+
+**Pydantic Fields:**
+
+- `data`: ``
+- `size`: ``
+- `mimetype`: ``
+- `digest`: ``
+- `filename`: ``
+- `content_type`: `typing.Literal['bytes', 'text', 'base64', 'file', 'url', 'data_url', 'data_url:base64', 'data_url:encoding', 'data_url:encoding:base64']`
+- `input_type`: ``
+- `encoding`: ``
+- `metadata`: `dict[str, typing.Any] | None`
+- `extension`: `str | None`
+
+---
+
+#### property art
+
+#### property ref
+
+---
+
+
+
+### method `as_string`
+
+```python
+as_string() → str
+```
+
+Display the data as a string. Bytes are decoded using the `encoding` attribute If base64, the data will be re-encoded to base64 bytes then decoded to an ASCII string
+
+**Returns:**
+ str.
+
+---
+
+
+
+### classmethod `from_base64`
+
+```python
+from_base64(
+ b64_data: 'str | bytes',
+ extension: 'str | None' = None,
+ mimetype: 'str | None' = None,
+ metadata: 'dict[str, Any] | None' = None
+) → Self
+```
+
+Initializes Content from a base64 encoded string or bytes.
+
+---
+
+
+
+### classmethod `from_bytes`
+
+```python
+from_bytes(
+ data: 'bytes',
+ extension: 'str | None' = None,
+ mimetype: 'str | None' = None,
+ metadata: 'dict[str, Any] | None' = None,
+ encoding: 'str' = 'utf-8'
+) → Self
+```
+
+Initializes Content from raw bytes.
+
+---
+
+
+
+### classmethod `from_data_url`
+
+```python
+from_data_url(url: 'str', metadata: 'dict[str, Any] | None' = None) → Self
+```
+
+Initializes Content from a data URL.
+
+---
+
+
+
+### classmethod `from_path`
+
+```python
+from_path(
+ path: 'str | Path',
+ encoding: 'str' = 'utf-8',
+ mimetype: 'str | None' = None,
+ metadata: 'dict[str, Any] | None' = None
+) → Self
+```
+
+Initializes Content from a local file path.
+
+---
+
+
+
+### classmethod `from_text`
+
+```python
+from_text(
+ text: 'str',
+ extension: 'str | None' = None,
+ mimetype: 'str | None' = None,
+ metadata: 'dict[str, Any] | None' = None,
+ encoding: 'str' = 'utf-8'
+) → Self
+```
+
+Initializes Content from a string of text.
+
+---
+
+
+
+### classmethod `from_url`
+
+```python
+from_url(
+ url: 'str',
+ headers: 'dict[str, Any] | None' = None,
+ timeout: 'int | None' = 30,
+ metadata: 'dict[str, Any] | None' = None
+) → Self
+```
+
+Initializes Content by fetching bytes from an HTTP(S) URL.
+
+Downloads the content, infers mimetype/extension from headers, URL path, and data, and constructs a Content object from the resulting bytes.
+
+---
+
+
+
+### classmethod `model_validate`
+
+```python
+model_validate(
+ obj: 'Any',
+ strict: 'bool | None' = None,
+ from_attributes: 'bool | None' = None,
+ context: 'dict[str, Any] | None' = None
+) → Self
+```
+
+Override model_validate to handle Content reconstruction from dict.
+
+---
+
+
+
+### classmethod `model_validate_json`
+
+```python
+model_validate_json(
+ json_data: 'str | bytes | bytearray',
+ strict: 'bool | None' = None,
+ context: 'dict[str, Any] | None' = None
+) → Self
+```
+
+Override model_validate_json to handle Content reconstruction from JSON.
+
+---
+
+
+
+### method `open`
+
+```python
+open() → bool
+```
+
+Open the file using the operating system's default application.
+
+This method uses the platform-specific mechanism to open the file with the default application associated with the file's type.
+
+**Returns:**
+
+ - `bool` : True if the file was successfully opened, False otherwise.
+
+---
+
+
+
+### method `save`
+
+```python
+save(dest: 'str | Path') → None
+```
+
+Copy the file to the specified destination path. Updates the filename and the path of the content to reflect the last saved copy.
+
+**Args:**
+
+
+---
+
+
+
+### method `serialize_data`
+
+```python
+serialize_data(data: 'bytes') → str
+```
+
+When dumping model in json mode
+
+---
+
+
+
+### method `to_data_url`
+
+```python
+to_data_url(use_base64: 'bool' = True) → str
+```
+
+Constructs a data URL from the content.
+
+ - `dest` : Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory. If dest has no file extension (e.g. .txt), destination will be considered a directory.
+**Args:**
+
+
+ - `use_base64` : If True, the data will be base64 encoded. Otherwise, it will be percent-encoded. Defaults to True.
+**Returns:**
+ A data URL string.
+
+---
+
+
+
+## class `Dataset`
+Dataset object with easy saving and automatic versioning.
+
+**Examples:**
+```python
+# Create a dataset
+dataset = Dataset(name='grammar', rows=[
+ {'id': '0', 'sentence': "He no likes ice cream.", 'correction': "He doesn't like ice cream."},
+ {'id': '1', 'sentence': "She goed to the store.", 'correction': "She went to the store."},
+ {'id': '2', 'sentence': "They plays video games all day.", 'correction': "They play video games all day."}
+])
+
+# Publish the dataset
+weave.publish(dataset)
+
+# Retrieve the dataset
+dataset_ref = weave.ref('grammar').get()
+
+# Access a specific example
+example_label = dataset_ref.rows[2]['sentence']
+```
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `rows`: `trace.table.Table | trace.vals.WeaveTable`
+
+
+
+### method `add_rows`
+
+```python
+add_rows(rows: Iterable[dict]) → Dataset
+```
+
+Create a new dataset version by appending rows to the existing dataset.
+
+This is useful for adding examples to large datasets without having to load the entire dataset into memory.
+
+**Args:**
+
+
+ - `rows` : The rows to add to the dataset.
+**Returns:**
+ The updated dataset.
+
+---
+
+
+
+### classmethod `convert_to_table`
+
+```python
+convert_to_table(rows: Any) → Table | WeaveTable
+```
+
+---
+
+
+
+### classmethod `from_calls`
+
+```python
+from_calls(calls: Iterable[Call]) → Self
+```
+
+---
+
+
+
+### classmethod `from_hf`
+
+```python
+from_hf(
+ hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')]
+) → Self
+```
+
+---
+
+
+
+### classmethod `from_obj`
+
+```python
+from_obj(obj: WeaveObject) → Self
+```
+
+---
+
+
+
+### classmethod `from_pandas`
+
+```python
+from_pandas(df: 'DataFrame') → Self
+```
+
+---
+
+
+
+### method `select`
+
+```python
+select(indices: Iterable[int]) → Self
+```
+
+Select rows from the dataset based on the provided indices.
+
+**Args:**
+
+
+ - `indices` : An iterable of integer indices specifying which rows to select.
+**Returns:**
+ A new Dataset object containing only the selected rows.
+
+---
+
+
+
+### method `to_hf`
+
+```python
+to_hf() → HFDataset
+```
+
+---
+
+
+
+### method `to_pandas`
+
+```python
+to_pandas() → DataFrame
+```
+
+---
+
+
+
+## class `EasyPrompt`
+
+
+
+### method `__init__`
+
+```python
+__init__(
+ content: str | dict | list | None = None,
+ role: str | None = None,
+ dedent: bool = False,
+ **kwargs: Any
+) → None
+```
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `data`: ``
+- `config`: ``
+- `requirements`: ``
+
+---
+
+#### property as_str
+
+Join all messages into a single string.
+
+---
+
+#### property is_bound
+
+---
+
+#### property messages
+
+#### property placeholders
+
+---
+
+#### property system_message
+
+Join all messages into a system prompt message.
+
+---
+
+#### property system_prompt
+
+Join all messages into a system prompt object.
+
+---
+
+#### property unbound_placeholders
+
+---
+
+
+
+### method `append`
+
+```python
+append(item: Any, role: str | None = None, dedent: bool = False) → None
+```
+
+---
+
+
+
+### method `as_dict`
+
+```python
+as_dict() → dict[str, Any]
+```
+
+---
+
+
+
+### method `as_pydantic_dict`
+
+```python
+as_pydantic_dict() → dict[str, Any]
+```
+
+---
+
+
+
+### method `bind`
+
+```python
+bind(*args: Any, **kwargs: Any) → Prompt
+```
+
+---
+
+
+
+### method `bind_rows`
+
+```python
+bind_rows(dataset: list[dict] | Any) → list['Prompt']
+```
+
+---
+
+
+
+### method `config_table`
+
+```python
+config_table(title: str | None = None) → Table
+```
+
+---
+
+
+
+### method `configure`
+
+```python
+configure(config: dict | None = None, **kwargs: Any) → Prompt
+```
+
+---
+
+
+
+### method `dump`
+
+```python
+dump(fp: ) → None
+```
+
+---
+
+
+
+### method `dump_file`
+
+```python
+dump_file(filepath: str | Path) → None
+```
+
+---
+
+
+
+### method `format`
+
+```python
+format(**kwargs: Any) → Any
+```
+
+---
+
+
+
+### classmethod `from_obj`
+
+```python
+from_obj(obj: WeaveObject) → Self
+```
+
+---
+
+
+
+### classmethod `load`
+
+```python
+load(fp: ) → Self
+```
+
+---
+
+
+
+### classmethod `load_file`
+
+```python
+load_file(filepath: str | Path) → Self
+```
+
+---
+
+
+
+### method `messages_table`
+
+```python
+messages_table(title: str | None = None) → Table
+```
+
+---
+
+
+
+### method `print`
+
+```python
+print() → str
+```
+
+---
+
+
+
+### method `publish`
+
+```python
+publish(name: str | None = None) → ObjectRef
+```
+
+---
+
+
+
+### method `require`
+
+```python
+require(param_name: str, **kwargs: Any) → Prompt
+```
+
+---
+
+
+
+### method `run`
+
+```python
+run() → Any
+```
+
+---
+
+
+
+### method `validate_requirement`
+
+```python
+validate_requirement(key: str, value: Any) → list
+```
+
+---
+
+
+
+### method `validate_requirements`
+
+```python
+validate_requirements(values: dict[str, Any]) → list
+```
+
+---
+
+
+
+### method `values_table`
+
+```python
+values_table(title: str | None = None) → Table
+```
+
+---
+
+
+
+## class `Evaluation`
+Sets up an evaluation which includes a set of scorers and a dataset.
+
+Calling evaluation.evaluate(model) will pass in rows from a dataset into a model matching the names of the columns of the dataset to the argument names in model.predict.
+
+Then it will call all of the scorers and save the results in weave.
+
+If you want to preprocess the rows from the dataset you can pass in a function to preprocess_model_input.
+
+**Examples:**
+```python
+# Collect your examples
+examples = [
+ {"question": "What is the capital of France?", "expected": "Paris"},
+ {"question": "Who wrote 'To Kill a Mockingbird'?", "expected": "Harper Lee"},
+ {"question": "What is the square root of 64?", "expected": "8"},
+]
+
+# Define any custom scoring function
+@weave.op
+def match_score1(expected: str, model_output: dict) -> dict:
+ # Here is where you'd define the logic to score the model output
+ return {'match': expected == model_output['generated_text']}
+
+@weave.op
+def function_to_evaluate(question: str):
+ # here's where you would add your LLM call and return the output
+ return {'generated_text': 'Paris'}
+
+# Score your examples using scoring functions
+evaluation = Evaluation(
+ dataset=examples, scorers=[match_score1]
+)
+
+# Start tracking the evaluation
+weave.init('intro-example')
+# Run the evaluation
+asyncio.run(evaluation.evaluate(function_to_evaluate))
+```
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `dataset`: ``
+- `scorers`: `list[typing.Annotated[trace.op_protocol.Op | flow.scorer.Scorer, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)]] | None`
+- `preprocess_model_input`: `collections.abc.Callable[[dict], dict] | None`
+- `trials`: ``
+- `metadata`: `dict[str, typing.Any] | None`
+- `evaluation_name`: `str | collections.abc.Callable[trace.call.Call, str] | None`
+
+
+
+### method `evaluate`
+
+```python
+evaluate(model: Op | Model) → dict
+```
+
+---
+
+
+
+### classmethod `from_obj`
+
+```python
+from_obj(obj: WeaveObject) → Self
+```
+
+---
+
+
+
+### method `get_eval_results`
+
+```python
+get_eval_results(model: Op | Model) → EvaluationResults
+```
+
+---
+
+
+
+### method `get_evaluate_calls`
+
+```python
+get_evaluate_calls() → PaginatedIterator[CallSchema, WeaveObject]
+```
+
+Retrieve all evaluation calls that used this Evaluation object.
+
+Note that this returns a CallsIter instead of a single call because it's possible to have multiple evaluation calls for a single evaluation (e.g. if you run the same evaluation multiple times).
+
+**Returns:**
+
+ - `CallsIter` : An iterator over Call objects representing evaluation runs.
+
+**Raises:**
+
+ - `ValueError` : If the evaluation has no ref (hasn't been saved/run yet).
+
+**Examples:**
+```python
+evaluation = Evaluation(dataset=examples, scorers=[scorer])
+await evaluation.evaluate(model) # Run evaluation first
+calls = evaluation.get_evaluate_calls()
+for call in calls:
+ print(f"Evaluation run: {call.id} at {call.started_at}")
+```
+
+---
+
+
+
+### method `get_score_calls`
+
+```python
+get_score_calls() → dict[str, list[Call]]
+```
+
+Retrieve scorer calls for each evaluation run, grouped by trace ID.
+
+**Returns:**
+
+ - `dict[str, list[Call]]` : A dictionary mapping trace IDs to lists of scorer Call objects. Each trace ID represents one evaluation run, and the list contains all scorer calls executed during that run.
+
+**Examples:**
+```python
+evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer])
+await evaluation.evaluate(model)
+score_calls = evaluation.get_score_calls()
+for trace_id, calls in score_calls.items():
+ print(f"Trace {trace_id}: {len(calls)} scorer calls")
+ for call in calls:
+ scorer_name = call.summary.get("weave", {}).get("trace_name")
+ print(f" Scorer: {scorer_name}, Output: {call.output}")
+```
+
+---
+
+
+
+### method `get_scores`
+
+```python
+get_scores() → dict[str, dict[str, list[Any]]]
+```
+
+Extract and organize scorer outputs from evaluation runs.
+
+**Returns:**
+
+ - `dict[str, dict[str, list[Any]]]` : A nested dictionary structure where:
+ - First level keys are trace IDs (evaluation runs)
+ - Second level keys are scorer names
+ - Values are lists of scorer outputs for that run and scorer
+
+**Examples:**
+```python
+evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer])
+await evaluation.evaluate(model)
+scores = evaluation.get_scores()
+# Access scores by trace and scorer
+for trace_id, trace_scores in scores.items():
+ print(f"Evaluation run {trace_id}:")
+ for scorer_name, outputs in trace_scores.items():
+ print(f" {scorer_name}: {outputs}")
+```
+
+Expected output:
+
+```
+{
+ "trace_123": {
+ "accuracy_scorer": [{"accuracy": 0.85}],
+ "f1_scorer": [{"f1": 0.78}]
+ }
+}
+```
+
+---
+
+
+
+### method `model_post_init`
+
+```python
+model_post_init(_Evaluation__context: Any) → None
+```
+
+---
+
+
+
+### method `predict_and_score`
+
+```python
+predict_and_score(model: Op | Model, example: dict) → dict
+```
+
+---
+
+
+
+### method `summarize`
+
+```python
+summarize(eval_table: EvaluationResults) → dict
+```
+
+---
+
+
+
+## class `EvaluationLogger`
+This class provides an imperative interface for logging evaluations.
+
+An evaluation is started automatically when the first prediction is logged using the `log_prediction` method, and finished when the `log_summary` method is called.
+
+Each time you log a prediction, you will get back a `ScoreLogger` object. You can use this object to log scores and metadata for that specific prediction. For more information, see the `ScoreLogger` class.
+
+Basic usage - log predictions with inputs and outputs directly:
+
+```python
+ev = EvaluationLogger()
+
+# Log predictions with known inputs/outputs
+pred = ev.log_prediction(inputs={'q': 'Hello'}, outputs={'a': 'Hi there!'})
+pred.log_score("correctness", 0.9)
+
+# Finish the evaluation
+ev.log_summary({"avg_score": 0.9})
+```
+
+Advanced usage - use context manager for dynamic outputs and nested operations:
+
+```python
+ev = EvaluationLogger()
+
+# Use context manager when you need to capture nested operations
+with ev.log_prediction(inputs={'q': 'Hello'}) as pred:
+ # Any operations here (like LLM calls) automatically become
+ # children of the predict call
+ response = your_llm_call(...)
+ pred.output = response.content
+ pred.log_score("correctness", 0.9)
+
+# Finish the evaluation
+ev.log_summary({"avg_score": 0.9})
+```
+
+
+
+### method `__init__`
+
+```python
+__init__(
+ name: 'str | None' = None,
+ model: 'Model | dict | str | None' = None,
+ dataset: 'Dataset | list[dict] | str | None' = None,
+ eval_attributes: 'dict[str, Any] | None' = None,
+ scorers: 'list[str] | None' = None
+) → None
+```
+
+---
+
+#### property attributes
+
+---
+
+#### property ui_url
-### function `init`
+---
+
+
+
+### method `fail`
```python
-init(
- project_name: 'str',
- settings: 'UserSettings | dict[str, Any] | None' = None,
- autopatch_settings: 'AutopatchSettings | None' = None,
- global_postprocess_inputs: 'PostprocessInputsFunc | None' = None,
- global_postprocess_output: 'PostprocessOutputFunc | None' = None,
- global_attributes: 'dict[str, Any] | None' = None
-) → WeaveClient
+fail(exception: 'BaseException') → None
```
-Initialize weave tracking, logging to a wandb project.
+Convenience method to fail the evaluation with an exception.
-Logging is initialized globally, so you do not need to keep a reference to the return value of init.
+---
-Following init, calls of weave.op() decorated functions will be logged to the specified project.
+
-**Args:**
-
+### method `finish`
-NOTE: Global postprocessing settings are applied to all ops after each op's own postprocessing. The order is always: 1. Op-specific postprocessing 2. Global postprocessing
+```python
+finish(exception: 'BaseException | None' = None) → None
+```
- - `project_name` : The name of the Weights & Biases team and project to log to. If you don't specify a team, your default entity is used. To find or update your default entity, refer to [User Settings](https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team) in the W&B Models documentation.
- - `settings` : Configuration for the Weave client generally.
- - `autopatch_settings` : (Deprecated) Configuration for autopatch integrations. Use explicit patching instead.
- - `global_postprocess_inputs` : A function that will be applied to all inputs of all ops.
- - `global_postprocess_output` : A function that will be applied to all outputs of all ops.
- - `global_attributes` : A dictionary of attributes that will be applied to all traces.
-**Returns:**
- A Weave client.
+Clean up the evaluation resources explicitly without logging a summary.
+
+Ensures all prediction calls and the main evaluation call are finalized. This is automatically called if the logger is used as a context manager.
---
-
+
-### function `publish`
+### method `log_example`
```python
-publish(obj: 'Any', name: 'str | None' = None) → ObjectRef
+log_example(
+ inputs: 'dict[str, Any]',
+ output: 'Any',
+ scores: 'dict[str, ScoreType]'
+) → None
```
-Save and version a Python object.
+Log a complete example with inputs, output, and scores.
-Weave creates a new version of the object if the object's name already exists and its content hash does not match the latest version of that object.
+This is a convenience method that combines log_prediction and log_score for when you have all the data upfront.
**Args:**
- - `obj` : The object to save and version.
- - `name` : The name to save the object under.
-**Returns:**
- A Weave Ref to the saved object.
+ - `inputs` : The input data for the prediction
+ - `output` : The output value
+ - `scores` : Dictionary mapping scorer names to score values
+**Example:**
+```python
+ev = EvaluationLogger()
+ev.log_example(
+ inputs={'q': 'What is 2+2?'},
+ output='4',
+ scores={'correctness': 1.0, 'fluency': 0.9}
+)
+```
---
-
+
-### function `ref`
+### method `log_prediction`
```python
-ref(location: 'str') → ObjectRef
+log_prediction(inputs: 'dict[str, Any]', output: 'Any' = None) → ScoreLogger
```
-Creates a Ref to an existing Weave object. This does not directly retrieve the object but allows you to pass it to other Weave API functions.
+Log a prediction to the Evaluation.
+
+Returns a ScoreLogger that can be used directly or as a context manager.
**Args:**
- - `location` : A Weave Ref URI, or if `weave.init()` has been called, `name:version` or `name`. If no version is provided, `latest` is used.
+ - `inputs` : The input data for the prediction
+ - `output` : The output value. Defaults to None. Can be set later using pred.output.
**Returns:**
- A Weave Ref to the object.
+ ScoreLogger for logging scores and optionally finishing the prediction.
+
+Example (direct):
+ - `pred = ev.log_prediction({'q'` : '...'}, output="answer") pred.log_score("correctness", 0.9) pred.finish()
+
+Example (context manager):
+ - `with ev.log_prediction({'q'` : '...'}) as pred: response = model(...) pred.output = response pred.log_score("correctness", 0.9) # Automatically calls finish() on exit
---
-
+
-### function `get`
+### method `log_summary`
```python
-get(uri: 'str | ObjectRef') → Any
+log_summary(summary: 'dict | None' = None, auto_summarize: 'bool' = True) → None
```
-A convenience function for getting an object from a URI.
+Log a summary dict to the Evaluation.
-Many objects logged by Weave are automatically registered with the Weave server. This function allows you to retrieve those objects by their URI.
+This will calculate the summary, call the summarize op, and then finalize the evaluation, meaning no more predictions or scores can be logged.
+
+---
+
+
+
+### method `set_view`
+
+```python
+set_view(
+ name: 'str',
+ content: 'Content | str',
+ extension: 'str | None' = None,
+ mimetype: 'str | None' = None,
+ metadata: 'dict[str, Any] | None' = None,
+ encoding: 'str' = 'utf-8'
+) → None
+```
+
+Attach a view to the evaluation's main call summary under `weave.views`.
+
+Saves the provided content as an object in the project and writes its reference URI under `summary.weave.views.` for the evaluation's `evaluate` call. String inputs are wrapped as text content using `Content.from_text` with the provided extension or mimetype.
**Args:**
- - `uri` : A fully-qualified weave ref URI.
+ - `name` : The view name to display, used as the key under `summary.weave.views`.
+ - `content` : A `weave.Content` instance or string to serialize.
+ - `extension` : Optional file extension for string content inputs.
+ - `mimetype` : Optional MIME type for string content inputs.
+ - `metadata` : Optional metadata attached to newly created `Content`.
+ - `encoding` : Text encoding for string content inputs.
**Returns:**
- The object.
+ None
+
+**Examples:**
+ ``` import weave```
+ >>> ev = weave.EvaluationLogger()
+ >>> ev.set_view("report", "# Report", extension="md")
+
+---
+
+
+
+## class `File`
+A class representing a file with path, mimetype, and size information.
+
+
+
+### method `__init__`
-**Example:**
```python
-weave.init("weave_get_example")
-dataset = weave.Dataset(rows=[{"a": 1, "b": 2}])
-ref = weave.publish(dataset)
+__init__(path: 'str | Path', mimetype: 'str | None' = None)
+```
-dataset2 = weave.get(ref) # same as dataset!
+Initialize a File object.
+
+**Args:**
+
+
+---
+
+#### property filename
+
+Get the filename of the file.
+
+ - `path` : Path to the file (string or pathlib.Path)
+ - `mimetype` : Optional MIME type of the file - will be inferred from extension if not provided
+**Returns:**
+
+ - `str` : The name of the file without the directory path.
+
+---
+
+
+
+### method `open`
+
+```python
+open() → bool
```
+Open the file using the operating system's default application.
+
+This method uses the platform-specific mechanism to open the file with the default application associated with the file's type.
+
+**Returns:**
+
+ - `bool` : True if the file was successfully opened, False otherwise.
+
---
-
+
-### function `require_current_call`
+### method `save`
```python
-require_current_call() → Call
+save(dest: 'str | Path') → None
```
-Get the Call object for the currently executing Op, within that Op.
+Copy the file to the specified destination path.
-This allows you to access attributes of the Call such as its id or feedback while it is running.
+**Args:**
+
+
+---
+
+
+
+## class `Markdown`
+A Markdown renderable.
+
+ - `dest` : Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory.
+**Args:**
+
+ - `markup` (str): A string containing markdown.
+ - `code_theme` (str, optional): Pygments theme for code blocks. Defaults to "monokai". See https://pygments.org/styles/ for code themes.
+ - `justify` (JustifyMethod, optional): Justify value for paragraphs. Defaults to None.
+ - `style` (Union[str, Style], optional): Optional style to apply to markdown.
+ - `hyperlinks` (bool, optional): Enable hyperlinks. Defaults to ``True``.
+
+
+
+### method `__init__`
```python
-@weave.op
-def hello(name: str) -> None:
- print(f"Hello {name}!")
- current_call = weave.require_current_call()
- print(current_call.id)
+__init__(
+ markup: 'str',
+ code_theme: 'str' = 'monokai',
+ justify: 'JustifyMethod | None' = None,
+ style: 'str | Style' = 'none',
+ hyperlinks: 'bool' = True,
+ inline_code_lexer: 'str | None' = None,
+ inline_code_theme: 'str | None' = None
+) → None
```
-It is also possible to access a Call after the Op has returned.
+---
-If you have the Call's id, perhaps from the UI, you can use the `get_call` method on the `WeaveClient` returned from `weave.init` to retrieve the Call object.
+
+
+## class `MessagesPrompt`
+
+
+
+### method `__init__`
```python
-client = weave.init("")
-mycall = client.get_call("")
+__init__(messages: list[dict])
```
-Alternately, after defining your Op you can use its `call` method. For example:
+ - `inline_code_lexer` : (str, optional): Lexer to use if inline code highlighting is enabled. Defaults to None.
+ - `inline_code_theme` : (Optional[str], optional): Pygments theme for inline code highlighting, or None for no highlighting. Defaults to None.
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `messages`: `list[dict]`
+
+
+
+### method `format`
```python
-@weave.op
-def add(a: int, b: int) -> int:
- return a + b
+format(**kwargs: Any) → list
+```
-result, call = add.call(1, 2)
-print(call.id)
+---
+
+
+
+### method `format_message`
+
+```python
+format_message(message: dict, **kwargs: Any) → dict
```
-**Returns:**
- The Call object for the currently executing Op
+Format a single message by replacing template variables.
-**Raises:**
-
- - `NoCurrentCallError` : If tracking has not been initialized or this method is invoked outside an Op.
+This method delegates to the standalone format_message_with_template_vars function for the actual formatting logic.
---
-
+
-### function `get_current_call`
+### classmethod `from_obj`
```python
-get_current_call() → Call | None
+from_obj(obj: WeaveObject) → Self
```
-Get the Call object for the currently executing Op, within that Op.
+---
-**Returns:**
- The Call object for the currently executing Op, or None if tracking has not been initialized or this method is invoked outside an Op.
+
+
+## class `Model`
+Intended to capture a combination of code and data the operates on an input. For example it might call an LLM with a prompt to make a prediction or generate text.
+
+When you change the attributes or the code that defines your model, these changes will be logged and the version will be updated. This ensures that you can compare the predictions across different versions of your model. Use this to iterate on prompts or to try the latest LLM and compare predictions across different settings
+
+**Examples:**
+```python
+class YourModel(Model):
+ attribute1: str
+ attribute2: int
-**Note:**
+ @weave.op
+ def predict(self, input_data: str) -> dict:
+ # Model logic goes here
+ prediction = self.attribute1 + ' ' + input_data
+ return {'pred': prediction}
+```
-> The returned Call's ``attributes`` dictionary becomes immutable once the call starts. Use :func:`weave.attributes` to set call metadata before invoking an Op. The ``summary`` field may be updated while the Op executes and will be merged with computed summary information when the call finishes.
+**Pydantic Fields:**
----
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
-
+
-### function `finish`
+### method `get_infer_method`
```python
-finish() → None
+get_infer_method() → Callable
```
-Stops logging to weave.
-
-Following finish, calls of weave.op() decorated functions will no longer be logged. You will need to run weave.init() again to resume logging.
-
---
-
+
-### function `op`
+## class `Monitor`
+Sets up a monitor to score incoming calls automatically.
+**Examples:**
```python
-op(
- func: 'Callable[P, R] | None' = None,
- name: 'str | None' = None,
- call_display_name: 'str | CallDisplayNameFunc | None' = None,
- postprocess_inputs: 'PostprocessInputsFunc | None' = None,
- postprocess_output: 'PostprocessOutputFunc | None' = None,
- tracing_sample_rate: 'float' = 1.0,
- enable_code_capture: 'bool' = True,
- accumulator: 'Callable[[Any | None, Any], Any] | None' = None
-) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]
+import weave
+from weave.scorers import ValidJSONScorer
+
+json_scorer = ValidJSONScorer()
+
+my_monitor = weave.Monitor(
+ name="my-monitor",
+ description="This is a test monitor",
+ sampling_rate=0.5,
+ op_names=["my_op"],
+ query={
+ "$expr": {
+ "$gt": [
+ {
+ "$getField": "started_at"
+ },
+ {
+ "$literal": 1742540400
+ }
+ ]
+ }
+ }
+ },
+ scorers=[json_scorer],
+)
+
+my_monitor.activate()
```
-A decorator to weave op-ify a function or method. Works for both sync and async. Automatically detects iterator functions and applies appropriate behavior.
+**Pydantic Fields:**
----
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `sampling_rate`: ``
+- `scorers`: `list[flow.scorer.Scorer]`
+- `op_names`: `list[str]`
+- `query`: `trace_server.interface.query.Query | None`
+- `active`: ``
-
+
-### function `attributes`
+### method `activate`
```python
-attributes(attributes: 'dict[str, Any]') → Iterator
+activate() → ObjectRef
```
-Context manager for setting attributes on a call.
+Activates the monitor.
-**Example:**
-```python
-with weave.attributes({'env': 'production'}):
- print(my_function.call("World"))
-```
+**Returns:**
+ The ref to the monitor.
---
-
+
-### function `thread`
+### method `deactivate`
```python
-thread(
- thread_id: 'str | None | object' =
-) → Iterator[ThreadContext]
+deactivate() → ObjectRef
```
-Context manager for setting thread_id on calls within the context.
+Deactivates the monitor.
-**Examples:**
-```python
-# Auto-generate thread_id
-with weave.thread() as t:
- print(f"Thread ID: {t.thread_id}")
- result = my_function("input") # This call will have the auto-generated thread_id
- print(f"Current turn: {t.turn_id}")
+**Returns:**
+ The ref to the monitor.
-# Explicit thread_id
-with weave.thread("custom_thread") as t:
- result = my_function("input") # This call will have thread_id="custom_thread"
+---
-# Disable threading
-with weave.thread(None) as t:
- result = my_function("input") # This call will have thread_id=None
-```
+
-**Args:**
-
+### classmethod `from_obj`
- - `thread_id` : The thread identifier to associate with calls in this context. If not provided, a UUID v7 will be auto-generated. If None, thread tracking will be disabled.
-**Yields:**
-
- - `ThreadContext` : An object providing access to thread_id and current turn_id.
+```python
+from_obj(obj: WeaveObject) → Self
+```
---
-
+
## class `Object`
Base class for Weave objects that can be tracked and versioned.
@@ -300,13 +1598,11 @@ obj = Object.from_uri("weave:///entity/project/object:digest")
**Pydantic Fields:**
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-
----------
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
-
+
### classmethod `from_uri`
@@ -336,7 +1632,7 @@ obj = MyObject.from_uri("weave:///entity/project/object:digest")
---
-
+
### classmethod `handle_relocatable_object`
@@ -373,1701 +1669,1530 @@ This validator handles special cases where the input is an ObjectRef or WeaveObj
---
-
-
-## class `Dataset`
-Dataset object with easy saving and automatic versioning.
-
-**Examples:**
-```python
-# Create a dataset
-dataset = Dataset(name='grammar', rows=[
- {'id': '0', 'sentence': "He no likes ice cream.", 'correction': "He doesn't like ice cream."},
- {'id': '1', 'sentence': "She goed to the store.", 'correction': "She went to the store."},
- {'id': '2', 'sentence': "They plays video games all day.", 'correction': "They play video games all day."}
-])
-
-# Publish the dataset
-weave.publish(dataset)
-
-# Retrieve the dataset
-dataset_ref = weave.ref('grammar').get()
-
-# Access a specific example
-example_label = dataset_ref.rows[2]['sentence']
-```
-
-**Pydantic Fields:**
-
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-- `rows`: `typing.Union[trace.table.Table, trace.vals.WeaveTable]`
-
----------
-
-
-
-### method `add_rows`
-
-```python
-add_rows(rows: Iterable[dict]) → Dataset
-```
-
-Create a new dataset version by appending rows to the existing dataset.
-
-This is useful for adding examples to large datasets without having to load the entire dataset into memory.
-
-**Args:**
-
-
- - `rows` : The rows to add to the dataset.
-**Returns:**
- The updated dataset.
+
----
+## class `ObjectRef`
+ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ())
-
+
-### classmethod `convert_to_table`
+### method `__init__`
```python
-convert_to_table(rows: Any) → Union[Table, WeaveTable]
+__init__(
+ entity: 'str',
+ project: 'str',
+ name: 'str',
+ _digest: 'str | Future[str]',
+ _extra: 'tuple[str | Future[str], ]' = ()
+) → None
```
---
-
-
-### classmethod `from_calls`
-
-```python
-from_calls(calls: Iterable[Call]) → Self
-```
+#### property digest
---
-
-
-### classmethod `from_hf`
-
-```python
-from_hf(
- hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')]
-) → Self
-```
+#### property extra
---
-
+
-### classmethod `from_obj`
+### method `as_param_dict`
```python
-from_obj(obj: WeaveObject) → Self
+as_param_dict() → dict
```
---
-
+
-### classmethod `from_pandas`
+### method `delete`
```python
-from_pandas(df: 'DataFrame') → Self
+delete() → None
```
---
-
+
-### method `select`
+### method `get`
```python
-select(indices: Iterable[int]) → Self
+get(objectify: 'bool' = True) → Any
```
-Select rows from the dataset based on the provided indices.
-
-**Args:**
-
-
- - `indices` : An iterable of integer indices specifying which rows to select.
-**Returns:**
- A new Dataset object containing only the selected rows.
-
---
-
+
-### method `to_hf`
+### method `is_descended_from`
```python
-to_hf() → HFDataset
+is_descended_from(potential_ancestor: 'ObjectRef') → bool
```
---
-
+
-### method `to_pandas`
+### method `maybe_parse_uri`
```python
-to_pandas() → DataFrame
+maybe_parse_uri(s: 'str') → AnyRef | None
```
---
-
-
-## class `Model`
-Intended to capture a combination of code and data the operates on an input. For example it might call an LLM with a prompt to make a prediction or generate text.
-
-When you change the attributes or the code that defines your model, these changes will be logged and the version will be updated. This ensures that you can compare the predictions across different versions of your model. Use this to iterate on prompts or to try the latest LLM and compare predictions across different settings
-
-**Examples:**
-```python
-class YourModel(Model):
- attribute1: str
- attribute2: int
-
- @weave.op()
- def predict(self, input_data: str) -> dict:
- # Model logic goes here
- prediction = self.attribute1 + ' ' + input_data
- return {'pred': prediction}
-```
-
-**Pydantic Fields:**
-
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
+
----------
-
-
-
-### method `get_infer_method`
+### method `parse_uri`
```python
-get_infer_method() → Callable
+parse_uri(uri: 'str') → ObjectRef
```
---
-
+
-## class `Prompt`
-
-**Pydantic Fields:**
-
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-
----------
-
-
-
-### method `format`
+### method `uri`
```python
-format(**kwargs: Any) → Any
+uri() → str
```
---
-
-
-## class `StringPrompt`
-
-
-
-### method `__init__`
-
-```python
-__init__(content: str)
-```
-
-**Pydantic Fields:**
-
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-- `content`: ``
-
----------
-
-
+
-### method `format`
+### method `with_attr`
```python
-format(**kwargs: Any) → str
+with_attr(attr: 'str') → Self
```
---
-
+
-### classmethod `from_obj`
+### method `with_extra`
```python
-from_obj(obj: WeaveObject) → Self
+with_extra(extra: 'tuple[str | Future[str], ]') → Self
```
---
-
+
-## class `MessagesPrompt`
-
-
-
-### method `__init__`
+### method `with_index`
```python
-__init__(messages: list[dict])
+with_index(index: 'int') → Self
```
-**Pydantic Fields:**
-
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-- `messages`: `list[dict]`
-
----------
+---
-
+
-### method `format`
+### method `with_item`
```python
-format(**kwargs: Any) → list
+with_item(item_digest: 'str | Future[str]') → Self
```
---
-
+
-### method `format_message`
+### method `with_key`
```python
-format_message(message: dict, **kwargs: Any) → dict
+with_key(key: 'str') → Self
```
---
-
+
-### classmethod `from_obj`
+## class `EasyPrompt`
+
+
+
+### method `__init__`
```python
-from_obj(obj: WeaveObject) → Self
+__init__(
+ content: str | dict | list | None = None,
+ role: str | None = None,
+ dedent: bool = False,
+ **kwargs: Any
+) → None
```
----
+**Pydantic Fields:**
-
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `data`: ``
+- `config`: ``
+- `requirements`: ``
-## class `Evaluation`
-Sets up an evaluation which includes a set of scorers and a dataset.
+---
-Calling evaluation.evaluate(model) will pass in rows from a dataset into a model matching the names of the columns of the dataset to the argument names in model.predict.
+#### property as_str
-Then it will call all of the scorers and save the results in weave.
+Join all messages into a single string.
-If you want to preprocess the rows from the dataset you can pass in a function to preprocess_model_input.
+---
-**Examples:**
-```python
-# Collect your examples
-examples = [
- {"question": "What is the capital of France?", "expected": "Paris"},
- {"question": "Who wrote 'To Kill a Mockingbird'?", "expected": "Harper Lee"},
- {"question": "What is the square root of 64?", "expected": "8"},
-]
+#### property is_bound
-# Define any custom scoring function
-@weave.op()
-def match_score1(expected: str, model_output: dict) -> dict:
- # Here is where you'd define the logic to score the model output
- return {'match': expected == model_output['generated_text']}
+---
-@weave.op()
-def function_to_evaluate(question: str):
- # here's where you would add your LLM call and return the output
- return {'generated_text': 'Paris'}
+#### property messages
-# Score your examples using scoring functions
-evaluation = Evaluation(
- dataset=examples, scorers=[match_score1]
-)
+#### property placeholders
-# Start tracking the evaluation
-weave.init('intro-example')
-# Run the evaluation
-asyncio.run(evaluation.evaluate(function_to_evaluate))
-```
+---
-**Pydantic Fields:**
+#### property system_message
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-- `dataset`: ``
-- `scorers`: `typing.Optional[list[typing.Annotated[typing.Union[trace.op_protocol.Op, flow.scorer.Scorer], BeforeValidator(func=, json_schema_input_type=PydanticUndefined)]]]`
-- `preprocess_model_input`: `typing.Optional[typing.Callable[[dict], dict]]`
-- `trials`: ``
-- `metadata`: `typing.Optional[dict[str, typing.Any]]`
-- `evaluation_name`: `typing.Union[str, typing.Callable[[trace.call.Call], str], NoneType]`
+Join all messages into a system prompt message.
----------
+---
-
+#### property system_prompt
-### method `evaluate`
+Join all messages into a system prompt object.
-```python
-evaluate(model: Union[Op, Model]) → dict
-```
+---
+
+#### property unbound_placeholders
---
-
+
-### classmethod `from_obj`
+### method `append`
```python
-from_obj(obj: WeaveObject) → Self
+append(item: Any, role: str | None = None, dedent: bool = False) → None
```
---
-
+
-### method `get_eval_results`
+### method `as_dict`
```python
-get_eval_results(model: Union[Op, Model]) → EvaluationResults
+as_dict() → dict[str, Any]
```
---
-
+
-### method `get_evaluate_calls`
+### method `as_pydantic_dict`
```python
-get_evaluate_calls() → PaginatedIterator[CallSchema, WeaveObject]
+as_pydantic_dict() → dict[str, Any]
```
-Retrieve all evaluation calls that used this Evaluation object.
-
-Note that this returns a CallsIter instead of a single call because it's possible to have multiple evaluation calls for a single evaluation (e.g. if you run the same evaluation multiple times).
+---
-**Returns:**
-
- - `CallsIter` : An iterator over Call objects representing evaluation runs.
+
-**Raises:**
-
- - `ValueError` : If the evaluation has no ref (hasn't been saved/run yet).
+### method `bind`
-**Examples:**
```python
-evaluation = Evaluation(dataset=examples, scorers=[scorer])
-await evaluation.evaluate(model) # Run evaluation first
-calls = evaluation.get_evaluate_calls()
-for call in calls:
- print(f"Evaluation run: {call.id} at {call.started_at}")
+bind(*args: Any, **kwargs: Any) → Prompt
```
---
-
+
-### method `get_score_calls`
+### method `bind_rows`
```python
-get_score_calls() → dict[str, list[Call]]
+bind_rows(dataset: list[dict] | Any) → list['Prompt']
```
-Retrieve scorer calls for each evaluation run, grouped by trace ID.
+---
-**Returns:**
-
- - `dict[str, list[Call]]` : A dictionary mapping trace IDs to lists of scorer Call objects. Each trace ID represents one evaluation run, and the list contains all scorer calls executed during that run.
+
+
+### method `config_table`
-**Examples:**
```python
-evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer])
-await evaluation.evaluate(model)
-score_calls = evaluation.get_score_calls()
-for trace_id, calls in score_calls.items():
- print(f"Trace {trace_id}: {len(calls)} scorer calls")
- for call in calls:
- scorer_name = call.summary.get("weave", {}).get("trace_name")
- print(f" Scorer: {scorer_name}, Output: {call.output}")
+config_table(title: str | None = None) → Table
```
---
-
+
-### method `get_scores`
+### method `configure`
```python
-get_scores() → dict[str, dict[str, list[Any]]]
+configure(config: dict | None = None, **kwargs: Any) → Prompt
```
-Extract and organize scorer outputs from evaluation runs.
-
-**Returns:**
-
- - `dict[str, dict[str, list[Any]]]` : A nested dictionary structure where:
- - First level keys are trace IDs (evaluation runs)
- - Second level keys are scorer names
- - Values are lists of scorer outputs for that run and scorer
+---
-**Examples:**
-```python
-evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer])
-await evaluation.evaluate(model)
-scores = evaluation.get_scores()
-# Access scores by trace and scorer
-for trace_id, trace_scores in scores.items():
- print(f"Evaluation run {trace_id}:")
- for scorer_name, outputs in trace_scores.items():
- print(f" {scorer_name}: {outputs}")
-```
+
-Expected output:
+### method `dump`
-```
-{
- "trace_123": {
- "accuracy_scorer": [{"accuracy": 0.85}],
- "f1_scorer": [{"f1": 0.78}]
- }
-}
+```python
+dump(fp: ) → None
```
---
-
+
-### method `model_post_init`
+### method `dump_file`
```python
-model_post_init(_Evaluation__context: Any) → None
+dump_file(filepath: str | Path) → None
```
---
-
+
-### method `predict_and_score`
+### method `format`
```python
-predict_and_score(model: Union[Op, Model], example: dict) → dict
+format(**kwargs: Any) → Any
```
---
-
+
-### method `summarize`
+### classmethod `from_obj`
```python
-summarize(eval_table: EvaluationResults) → dict
+from_obj(obj: WeaveObject) → Self
```
---
-
+
-## class `EvaluationLogger`
-This class provides an imperative interface for logging evaluations.
+### classmethod `load`
-An evaluation is started automatically when the first prediction is logged using the `log_prediction` method, and finished when the `log_summary` method is called.
+```python
+load(fp: ) → Self
+```
-Each time you log a prediction, you will get back a `ScoreLogger` object. You can use this object to log scores and metadata for that specific prediction. For more information, see the `ScoreLogger` class.
+---
-Basic usage - log predictions with inputs and outputs directly:
+
+
+### classmethod `load_file`
```python
-ev = EvaluationLogger()
+load_file(filepath: str | Path) → Self
+```
-# Log predictions with known inputs/outputs
-pred = ev.log_prediction(inputs={'q': 'Hello'}, outputs={'a': 'Hi there!'})
-pred.log_score("correctness", 0.9)
+---
-# Finish the evaluation
-ev.log_summary({"avg_score": 0.9})
-```
+
-Advanced usage - use context manager for dynamic outputs and nested operations:
+### method `messages_table`
```python
-ev = EvaluationLogger()
+messages_table(title: str | None = None) → Table
+```
-# Use context manager when you need to capture nested operations
-with ev.log_prediction(inputs={'q': 'Hello'}) as pred:
- # Any operations here (like LLM calls) automatically become
- # children of the predict call
- response = your_llm_call(...)
- pred.output = response.content
- pred.log_score("correctness", 0.9)
+---
-# Finish the evaluation
-ev.log_summary({"avg_score": 0.9})
-```
+
-**Pydantic Fields:**
+### method `print`
-- `name`: `str | None`
-- `model`: `flow.model.Model | dict | str`
-- `dataset`: `dataset.dataset.Dataset | list[dict] | str`
-- `eval_attributes`: `dict[str, typing.Any]`
-- `scorers`: `list[str] | None`
+```python
+print() → str
+```
---
-#### property attributes
+
----------
+### method `publish`
-#### property ui_url
+```python
+publish(name: str | None = None) → ObjectRef
+```
---
-
+
-### method `fail`
+### method `require`
```python
-fail(exception: 'BaseException') → None
+require(param_name: str, **kwargs: Any) → Prompt
```
-Convenience method to fail the evaluation with an exception.
-
---
-
+
-### method `finish`
+### method `run`
```python
-finish(exception: 'BaseException | None' = None) → None
+run() → Any
```
-Clean up the evaluation resources explicitly without logging a summary.
-
-Ensures all prediction calls and the main evaluation call are finalized. This is automatically called if the logger is used as a context manager.
-
---
-
+
-### method `log_prediction`
+### method `validate_requirement`
```python
-log_prediction(
- inputs: 'dict[str, Any]',
- output: 'Any | _NotSetType' =
-) → ScoreLogger | _LogPredictionContext
+validate_requirement(key: str, value: Any) → list
```
-Log a prediction to the Evaluation.
-
-If output is provided, returns a ScoreLogger for direct use. If output is not provided, returns a PredictionContext for use as a context manager.
-
-**Args:**
-
+---
- - `inputs` : The input data for the prediction
- - `output` : The output value. If not provided, use as context manager to set later.
-**Returns:**
- ScoreLogger if output provided, PredictionContext if not.
+
-Example (direct):
- - `pred = ev.log_prediction({'q'` : '...'}, output="answer") pred.log_score("correctness", 0.9) pred.finish()
+### method `validate_requirements`
-Example (context manager):
- - `with ev.log_prediction({'q'` : '...'}) as pred: response = model(...) pred.output = response pred.log_score("correctness", 0.9)
+```python
+validate_requirements(values: dict[str, Any]) → list
+```
---
-
+
-### method `log_summary`
+### method `values_table`
```python
-log_summary(summary: 'dict | None' = None, auto_summarize: 'bool' = True) → None
+values_table(title: str | None = None) → Table
```
-Log a summary dict to the Evaluation.
+---
-This will calculate the summary, call the summarize op, and then finalize the evaluation, meaning no more predictions or scores can be logged.
+
----
+## class `Prompt`
-
+**Pydantic Fields:**
-### method `model_post_init`
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+
+
+
+### method `format`
```python
-model_post_init(_EvaluationLogger__context: 'Any') → None
+format(**kwargs: Any) → Any
```
-Initialize the pseudo evaluation with the dataset from the model.
-
---
-
-
-### method `set_view`
+
-```python
-set_view(
- name: 'str',
- content: 'Content | str',
- extension: 'str | None' = None,
- mimetype: 'str | None' = None,
- metadata: 'dict[str, Any] | None' = None,
- encoding: 'str' = 'utf-8'
-) → None
-```
+## class `SavedView`
+A fluent-style class for working with SavedView objects.
-Attach a view to the evaluation's main call summary under `weave.views`.
+
-Saves the provided content as an object in the project and writes its reference URI under `summary.weave.views.` for the evaluation's `evaluate` call. String inputs are wrapped as text content using `Content.from_text` with the provided extension or mimetype.
+### method `__init__`
-**Args:**
-
+```python
+__init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None
+```
- - `name` : The view name to display, used as the key under `summary.weave.views`.
- - `content` : A `weave.Content` instance or string to serialize.
- - `extension` : Optional file extension for string content inputs.
- - `mimetype` : Optional MIME type for string content inputs.
- - `metadata` : Optional metadata attached to newly created `Content`.
- - `encoding` : Text encoding for string content inputs.
-**Returns:**
- None
+---
-**Examples:**
- ``` import weave```
- >>> ev = weave.EvaluationLogger()
- >>> ev.set_view("report", "# Report", extension="md")
+#### property entity
---
-
+#### property label
-## class `Scorer`
+---
-**Pydantic Fields:**
+#### property project
+
+---
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-- `column_map`: `typing.Optional[dict[str, str]]`
+#### property view_type
----------
+---
-
+
-### classmethod `from_obj`
+### method `add_column`
```python
-from_obj(obj: WeaveObject) → Self
+add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView
```
---
-
+
-### method `model_post_init`
+### method `add_columns`
```python
-model_post_init(_Scorer__context: Any) → None
+add_columns(*columns: 'str') → SavedView
```
+Convenience method for adding multiple columns to the grid.
+
---
-
+
-### method `score`
+### method `add_filter`
```python
-score(output: Any, **kwargs: Any) → Any
+add_filter(
+ field: 'str',
+ operator: 'str',
+ value: 'Any | None' = None
+) → SavedView
```
---
-
+
-### method `summarize`
+### method `add_sort`
```python
-summarize(score_rows: list) → Optional[dict]
+add_sort(field: 'str', direction: 'SortDirection') → SavedView
```
---
-
-
-## class `AnnotationSpec`
+
-**Pydantic Fields:**
+### method `column_index`
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `field_schema`: `dict[str, typing.Any]`
-- `unique_among_creators`: ``
-- `op_scope`: `typing.Optional[list[str]]`
+```python
+column_index(path: 'int | str | ObjectPath') → int
+```
----------
+---
-
+
-### classmethod `preprocess_field_schema`
+### method `filter_op`
```python
-preprocess_field_schema(data: dict[str, Any]) → dict[str, Any]
+filter_op(op_name: 'str | None') → SavedView
```
---
-
+
-### classmethod `validate_field_schema`
+### method `get_calls`
```python
-validate_field_schema(schema: dict[str, Any]) → dict[str, Any]
+get_calls(
+ limit: 'int | None' = None,
+ offset: 'int | None' = None,
+ include_costs: 'bool' = False,
+ include_feedback: 'bool' = False,
+ all_columns: 'bool' = False
+) → CallsIter
```
+Get calls matching this saved view's filters and settings.
+
---
-
+
-### method `value_is_valid`
+### method `get_known_columns`
```python
-value_is_valid(payload: Any) → bool
+get_known_columns(num_calls_to_query: 'int | None' = None) → list[str]
```
-Validates a payload against this annotation spec's schema.
+Get the set of columns that are known to exist.
-**Args:**
-
+---
- - `payload` : The data to validate against the schema
-**Returns:**
-
- - `bool` : True if validation succeeds, False otherwise
+
----
+### method `get_table_columns`
-
+```python
+get_table_columns() → list[TableColumn]
+```
-## class `File`
-A class representing a file with path, mimetype, and size information.
+---
-
+
-### method `__init__`
+### method `hide_column`
```python
-__init__(path: 'str | Path', mimetype: 'str | None' = None)
+hide_column(col_name: 'str') → SavedView
```
-Initialize a File object.
-
-**Args:**
-
-
---
-#### property filename
+
-Get the filename of the file.
+### method `insert_column`
- - `path` : Path to the file (string or pathlib.Path)
- - `mimetype` : Optional MIME type of the file - will be inferred from extension if not provided
-**Returns:**
-
- - `str` : The name of the file without the directory path.
+```python
+insert_column(
+ idx: 'int',
+ path: 'str | ObjectPath',
+ label: 'str | None' = None
+) → SavedView
+```
---
-
+
-### method `open`
+### classmethod `load`
```python
-open() → bool
+load(ref: 'str') → Self
```
-Open the file using the operating system's default application.
+---
-This method uses the platform-specific mechanism to open the file with the default application associated with the file's type.
+
-**Returns:**
-
- - `bool` : True if the file was successfully opened, False otherwise.
+### method `page_size`
+
+```python
+page_size(page_size: 'int') → SavedView
+```
---
-
+
-### method `save`
+### method `pin_column_left`
```python
-save(dest: 'str | Path') → None
+pin_column_left(col_name: 'str') → SavedView
```
-Copy the file to the specified destination path.
-
-**Args:**
-
-
---
-
+
-## class `Content`
-A class to represent content from various sources, resolving them to a unified byte-oriented representation with associated metadata.
+### method `pin_column_right`
-This class must be instantiated using one of its classmethods:
-- from_path()
-- from_bytes()
-- from_text()
-- from_url()
-- from_base64()
-- from_data_url()
+```python
+pin_column_right(col_name: 'str') → SavedView
+```
-
+---
-### method `__init__`
+
+
+### method `remove_column`
```python
-__init__(*args: 'Any', **kwargs: 'Any') → None
+remove_column(path: 'int | str | ObjectPath') → SavedView
```
-Direct initialization is disabled. Please use a classmethod like `Content.from_path()` to create an instance.
+---
- - `dest` : Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory.
-**Pydantic Fields:**
+
-- `data`: ``
-- `size`: ``
-- `mimetype`: ``
-- `digest`: ``
-- `filename`: ``
-- `content_type`: `typing.Literal['bytes', 'text', 'base64', 'file', 'url', 'data_url', 'data_url:base64', 'data_url:encoding', 'data_url:encoding:base64']`
-- `input_type`: ``
-- `encoding`: ``
-- `metadata`: `dict[str, typing.Any] | None`
-- `extension`: `str | None`
+### method `remove_columns`
+
+```python
+remove_columns(*columns: 'str') → SavedView
+```
+
+Remove columns from the saved view.
---
-#### property art
+
----------
+### method `remove_filter`
-#### property ref
+```python
+remove_filter(index_or_field: 'int | str') → SavedView
+```
---
-
+
-### method `as_string`
+### method `remove_filters`
```python
-as_string() → str
+remove_filters() → SavedView
```
-Display the data as a string. Bytes are decoded using the `encoding` attribute If base64, the data will be re-encoded to base64 bytes then decoded to an ASCII string
-
-**Returns:**
- str.
+Remove all filters from the saved view.
---
-
+
-### classmethod `from_base64`
+### method `rename`
```python
-from_base64(
- b64_data: 'str | bytes',
- extension: 'str | None' = None,
- mimetype: 'str | None' = None,
- metadata: 'dict[str, Any] | None' = None
-) → Self
+rename(label: 'str') → SavedView
```
-Initializes Content from a base64 encoded string or bytes.
-
---
-
+
-### classmethod `from_bytes`
+### method `rename_column`
```python
-from_bytes(
- data: 'bytes',
- extension: 'str | None' = None,
- mimetype: 'str | None' = None,
- metadata: 'dict[str, Any] | None' = None,
- encoding: 'str' = 'utf-8'
-) → Self
+rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView
```
-Initializes Content from raw bytes.
-
---
-
+
-### classmethod `from_data_url`
+### method `save`
```python
-from_data_url(url: 'str', metadata: 'dict[str, Any] | None' = None) → Self
+save() → SavedView
```
-Initializes Content from a data URL.
+Publish the saved view to the server.
---
-
+
-### classmethod `from_path`
+### method `set_columns`
```python
-from_path(
- path: 'str | Path',
- encoding: 'str' = 'utf-8',
- mimetype: 'str | None' = None,
- metadata: 'dict[str, Any] | None' = None
-) → Self
+set_columns(*columns: 'str') → SavedView
```
-Initializes Content from a local file path.
+Set the columns to be displayed in the grid.
---
-
+
-### classmethod `from_text`
+### method `show_column`
```python
-from_text(
- text: 'str',
- extension: 'str | None' = None,
- mimetype: 'str | None' = None,
- metadata: 'dict[str, Any] | None' = None,
- encoding: 'str' = 'utf-8'
-) → Self
+show_column(col_name: 'str') → SavedView
```
-Initializes Content from a string of text.
-
---
-
+
-### classmethod `from_url`
+### method `sort_by`
```python
-from_url(
- url: 'str',
- headers: 'dict[str, Any] | None' = None,
- timeout: 'int | None' = 30,
- metadata: 'dict[str, Any] | None' = None
-) → Self
+sort_by(field: 'str', direction: 'SortDirection') → SavedView
```
-Initializes Content by fetching bytes from an HTTP(S) URL.
-
-Downloads the content, infers mimetype/extension from headers, URL path, and data, and constructs a Content object from the resulting bytes.
-
---
-
+
-### classmethod `model_validate`
+### method `to_grid`
```python
-model_validate(
- obj: 'Any',
- strict: 'bool | None' = None,
- from_attributes: 'bool | None' = None,
- context: 'dict[str, Any] | None' = None
-) → Self
+to_grid(limit: 'int | None' = None) → Grid
```
-Override model_validate to handle Content reconstruction from dict.
-
---
-
+
-### classmethod `model_validate_json`
+### method `to_rich_table_str`
```python
-model_validate_json(
- json_data: 'str | bytes | bytearray',
- strict: 'bool | None' = None,
- context: 'dict[str, Any] | None' = None
-) → Self
+to_rich_table_str() → str
```
-Override model_validate_json to handle Content reconstruction from JSON.
-
---
-
+
-### method `open`
+### method `ui_url`
```python
-open() → bool
+ui_url() → str | None
```
-Open the file using the operating system's default application.
-
-This method uses the platform-specific mechanism to open the file with the default application associated with the file's type.
+URL to show this saved view in the UI.
-**Returns:**
-
- - `bool` : True if the file was successfully opened, False otherwise.
+Note this is the "result" page with traces etc, not the URL for the view object.
---
-
+
-### method `save`
+### method `unpin_column`
```python
-save(dest: 'str | Path') → None
+unpin_column(col_name: 'str') → SavedView
```
-Copy the file to the specified destination path. Updates the filename and the path of the content to reflect the last saved copy.
+---
-**Args:**
-
+
----
+## class `Scorer`
-
+**Pydantic Fields:**
-### method `serialize_data`
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `column_map`: `dict[str, str] | None`
+
+
+
+### classmethod `from_obj`
```python
-serialize_data(data: 'bytes') → str
+from_obj(obj: WeaveObject) → Self
```
-When dumping model in json mode
-
---
-
+
-### method `to_data_url`
+### method `model_post_init`
```python
-to_data_url(use_base64: 'bool' = True) → str
+model_post_init(_Scorer__context: Any) → None
```
-Constructs a data URL from the content.
+---
- - `dest` : Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory. If dest has no file extension (e.g. .txt), destination will be considered a directory.
-**Args:**
-
+
- - `use_base64` : If True, the data will be base64 encoded. Otherwise, it will be percent-encoded. Defaults to True.
-**Returns:**
- A data URL string.
+### method `score`
+
+```python
+score(output: Any, **kwargs: Any) → Any
+```
---
-
+
-## class `Markdown`
-A Markdown renderable.
+### method `summarize`
-**Args:**
-
- - `markup` (str): A string containing markdown.
- - `code_theme` (str, optional): Pygments theme for code blocks. Defaults to "monokai". See https://pygments.org/styles/ for code themes.
- - `justify` (JustifyMethod, optional): Justify value for paragraphs. Defaults to None.
- - `style` (Union[str, Style], optional): Optional style to apply to markdown.
- - `hyperlinks` (bool, optional): Enable hyperlinks. Defaults to ``True``.
+```python
+summarize(score_rows: list) → dict | None
+```
+
+---
+
+
+
+## class `StringPrompt`
-
+
### method `__init__`
```python
-__init__(
- markup: 'str',
- code_theme: 'str' = 'monokai',
- justify: 'JustifyMethod | None' = None,
- style: 'str | Style' = 'none',
- hyperlinks: 'bool' = True,
- inline_code_lexer: 'str | None' = None,
- inline_code_theme: 'str | None' = None
-) → None
+__init__(content: str)
```
----
+**Pydantic Fields:**
-
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `content`: ``
-## class `Monitor`
-Sets up a monitor to score incoming calls automatically.
+
+
+### method `format`
- - `inline_code_lexer` : (str, optional): Lexer to use if inline code highlighting is enabled. Defaults to None.
- - `inline_code_theme` : (Optional[str], optional): Pygments theme for inline code highlighting, or None for no highlighting. Defaults to None.
-**Examples:**
```python
-import weave
-from weave.scorers import ValidJSONScorer
+format(**kwargs: Any) → str
+```
-json_scorer = ValidJSONScorer()
+---
-my_monitor = weave.Monitor(
- name="my-monitor",
- description="This is a test monitor",
- sampling_rate=0.5,
- op_names=["my_op"],
- query={
- "$expr": {
- "$gt": [
- {
- "$getField": "started_at"
- },
- {
- "$literal": 1742540400
- }
- ]
- }
- }
- },
- scorers=[json_scorer],
-)
+
-my_monitor.activate()
+### classmethod `from_obj`
+
+```python
+from_obj(obj: WeaveObject) → Self
```
-**Pydantic Fields:**
+---
-- `name`: `typing.Optional[str]`
-- `description`: `typing.Optional[str]`
-- `ref`: `typing.Optional[trace.refs.ObjectRef]`
-- `sampling_rate`: ``
-- `scorers`: `list[flow.scorer.Scorer]`
-- `op_names`: `list[str]`
-- `query`: `typing.Optional[trace_server.interface.query.Query]`
-- `active`: ``
+
----------
+## class `Table`
-
+
-### method `activate`
+### method `__init__`
```python
-activate() → ObjectRef
+__init__(rows: 'list[dict]') → None
```
-Activates the monitor.
+---
-**Returns:**
- The ref to the monitor.
+#### property rows
---
-
+
-### method `deactivate`
+### method `append`
```python
-deactivate() → ObjectRef
+append(row: 'dict') → None
```
-Deactivates the monitor.
-
-**Returns:**
- The ref to the monitor.
+Add a row to the table.
---
-
+
-### classmethod `from_obj`
+### method `pop`
```python
-from_obj(obj: WeaveObject) → Self
+pop(index: 'int') → None
```
+Remove a row at the given index from the table.
+
---
-
+
-## class `SavedView`
-A fluent-style class for working with SavedView objects.
+## class `ContextAwareThread`
+A Thread that runs functions with the context of the caller.
-
+This is a drop-in replacement for threading.Thread that ensures calls behave as expected inside the thread. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this thread "just works" as the user probably expects.
-### method `__init__`
+You can achieve the same effect without this class by instead writing:
```python
-__init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None
-```
+def run_with_context(func, *args, **kwargs):
+ context = copy_context()
+ def wrapper():
+ context.run(func, *args, **kwargs)
+ return wrapper
----
+thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs))
+thread.start()
+```
-#### property entity
+
----
+### method `__init__`
-#### property label
+```python
+__init__(*args: 'Any', **kwargs: 'Any') → None
+```
---
-#### property project
+#### property daemon
----
+A boolean value indicating whether this thread is a daemon thread.
-#### property view_type
+This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.
+
+The entire Python program exits when only daemon threads are left.
---
-
+#### property ident
-### method `add_column`
+Thread identifier of this thread or None if it has not been started.
-```python
-add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView
-```
+This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited.
---
-
+#### property name
-### method `add_columns`
-
-```python
-add_columns(*columns: 'str') → SavedView
-```
+A string used for identification purposes only.
-Convenience method for adding multiple columns to the grid.
+It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
---
-
+#### property native_id
-### method `add_filter`
+Native integral thread ID of this thread, or None if it has not been started.
-```python
-add_filter(
- field: 'str',
- operator: 'str',
- value: 'Any | None' = None
-) → SavedView
-```
+This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel.
---
-
+
-### method `add_sort`
+### method `run`
```python
-add_sort(field: 'str', direction: 'SortDirection') → SavedView
+run() → None
```
---
-
+
-### method `column_index`
+## class `ThreadContext`
+Context object providing access to current thread and turn information.
+
+
+
+### method `__init__`
```python
-column_index(path: 'int | str | ObjectPath') → int
+__init__(thread_id: 'str | None')
```
+Initialize ThreadContext with the specified thread_id.
+
+**Args:**
+
+
---
-
+#### property thread_id
-### method `filter_op`
+Get the thread_id for this context.
-```python
-filter_op(op_name: 'str | None') → SavedView
-```
+ - `thread_id` : The thread identifier for this context, or None if disabled.
+**Returns:**
+ The thread identifier, or None if thread tracking is disabled.
---
-
-
-### method `get_calls`
+#### property turn_id
-```python
-get_calls(
- limit: 'int | None' = None,
- offset: 'int | None' = None,
- include_costs: 'bool' = False,
- include_feedback: 'bool' = False,
- all_columns: 'bool' = False
-) → CallsIter
-```
+Get the current turn_id from the active context.
-Get calls matching this saved view's filters and settings.
+**Returns:**
+ The current turn_id if set, None otherwise.
---
-
+
-### method `get_known_columns`
+## class `ContextAwareThreadPoolExecutor`
+A ThreadPoolExecutor that runs functions with the context of the caller.
+
+This is a drop-in replacement for concurrent.futures.ThreadPoolExecutor that ensures weave calls behave as expected inside the executor. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this executor "just works" as the user probably expects.
+
+You can achieve the same effect without this class by instead writing:
```python
-get_known_columns(num_calls_to_query: 'int | None' = None) → list[str]
-```
+with concurrent.futures.ThreadPoolExecutor() as executor:
+ contexts = [copy_context() for _ in range(len(vals))]
-Get the set of columns that are known to exist.
+ def _wrapped_fn(*args):
+ return contexts.pop().run(fn, *args)
----
+ executor.map(_wrapped_fn, vals)
+```
-
+
-### method `get_table_columns`
+### method `__init__`
```python
-get_table_columns() → list[TableColumn]
+__init__(*args: 'Any', **kwargs: 'Any') → None
```
---
-
+
-### method `hide_column`
+### method `map`
```python
-hide_column(col_name: 'str') → SavedView
+map(
+ fn: 'Callable',
+ *iterables: 'Iterable[Any]',
+ timeout: 'float | None' = None,
+ chunksize: 'int' = 1
+) → Iterator
```
---
-
+
-### method `insert_column`
+### method `submit`
```python
-insert_column(
- idx: 'int',
- path: 'str | ObjectPath',
- label: 'str | None' = None
-) → SavedView
+submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any
```
---
-
+
-### classmethod `load`
+### function `as_op`
```python
-load(ref: 'str') → SavedView
+as_op(fn: 'Callable[P, R]') → Op[P, R]
```
----
+Given a @weave.op decorated function, return its Op.
-
+@weave.op decorated functions are instances of Op already, so this function should be a no-op at runtime. But you can use it to satisfy type checkers if you need to access OpDef attributes in a typesafe way.
-### method `page_size`
+**Args:**
+
-```python
-page_size(page_size: 'int') → SavedView
-```
+ - `fn` : A weave.op decorated function.
+**Returns:**
+ The Op of the function.
---
-
+
-### method `pin_column_left`
+### function `attributes`
```python
-pin_column_left(col_name: 'str') → SavedView
+attributes(attributes: 'dict[str, Any]') → Iterator
```
----
-
-
-
-### method `pin_column_right`
+Context manager for setting attributes on a call.
+**Example:**
```python
-pin_column_right(col_name: 'str') → SavedView
+with weave.attributes({'env': 'production'}):
+ print(my_function.call("World"))
```
---
-
+
-### method `remove_column`
+### function `finish`
```python
-remove_column(path: 'int | str | ObjectPath') → SavedView
+finish() → None
```
+Stops logging to weave.
+
+Following finish, calls of weave.op decorated functions will no longer be logged. You will need to run weave.init() again to resume logging.
+
---
-
+
-### method `remove_columns`
+### function `get`
```python
-remove_columns(*columns: 'str') → SavedView
+get(uri: 'str | ObjectRef') → Any
```
-Remove columns from the saved view.
+A convenience function for getting an object from a URI.
----
+Many objects logged by Weave are automatically registered with the Weave server. This function allows you to retrieve those objects by their URI.
-
+**Args:**
+
-### method `remove_filter`
+ - `uri` : A fully-qualified weave ref URI.
+**Returns:**
+ The object.
+**Example:**
```python
-remove_filter(index_or_field: 'int | str') → SavedView
+weave.init("weave_get_example")
+dataset = weave.Dataset(rows=[{"a": 1, "b": 2}])
+ref = weave.publish(dataset)
+
+dataset2 = weave.get(ref) # same as dataset!
```
---
-
+
-### method `remove_filters`
+### function `get_client`
```python
-remove_filters() → SavedView
+get_client() → WeaveClient | None
```
-Remove all filters from the saved view.
-
---
-
+
-### method `rename`
+### function `get_current_call`
```python
-rename(label: 'str') → SavedView
+get_current_call() → Call | None
```
----
+Get the Call object for the currently executing Op, within that Op.
-
+**Returns:**
+ The Call object for the currently executing Op, or None if tracking has not been initialized or this method is invoked outside an Op.
-### method `rename_column`
+**Note:**
-```python
-rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView
-```
+> The returned Call's ``attributes`` dictionary becomes immutable once the call starts. Use :func:`weave.attributes` to set call metadata before invoking an Op. The ``summary`` field may be updated while the Op executes and will be merged with computed summary information when the call finishes.
---
-
+
-### method `save`
+### function `init`
```python
-save() → SavedView
+init(
+ project_name: 'str',
+ settings: 'UserSettings | dict[str, Any] | None' = None,
+ autopatch_settings: 'AutopatchSettings | None' = None,
+ global_postprocess_inputs: 'PostprocessInputsFunc | None' = None,
+ global_postprocess_output: 'PostprocessOutputFunc | None' = None,
+ global_attributes: 'dict[str, Any] | None' = None
+) → WeaveClient
```
-Publish the saved view to the server.
+Initialize weave tracking, logging to a wandb project.
----
+Logging is initialized globally, so you do not need to keep a reference to the return value of init.
-
+Following init, calls of weave.op decorated functions will be logged to the specified project.
-### method `set_columns`
+**Args:**
+
-```python
-set_columns(*columns: 'str') → SavedView
-```
+NOTE: Global postprocessing settings are applied to all ops after each op's own postprocessing. The order is always: 1. Op-specific postprocessing 2. Global postprocessing
-Set the columns to be displayed in the grid.
+ - `project_name` : The name of the Weights & Biases team and project to log to. If you don't specify a team, your default entity is used. To find or update your default entity, refer to [User Settings](https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team) in the W&B Models documentation.
+ - `settings` : Configuration for the Weave client generally.
+ - `autopatch_settings` : (Deprecated) Configuration for autopatch integrations. Use explicit patching instead.
+ - `global_postprocess_inputs` : A function that will be applied to all inputs of all ops.
+ - `global_postprocess_output` : A function that will be applied to all outputs of all ops.
+ - `global_attributes` : A dictionary of attributes that will be applied to all traces.
+**Returns:**
+ A Weave client.
---
-
+
-### method `show_column`
+### function `log_call`
```python
-show_column(col_name: 'str') → SavedView
+log_call(
+ op: 'str',
+ inputs: 'dict[str, Any]',
+ output: 'Any',
+ parent: 'Call | None' = None,
+ attributes: 'dict[str, Any] | None' = None,
+ display_name: 'str | Callable[[Call], str] | None' = None,
+ use_stack: 'bool' = True,
+ exception: 'BaseException | None' = None
+) → Call
```
----
+Log a call directly to Weave without using the decorator pattern.
-
+This function provides an imperative API for logging operations to Weave, useful when you want to log calls after they've already been executed or when the decorator pattern isn't suitable for your use case.
-### method `sort_by`
+**Args:**
+
+ - `op` (str): The operation name to log. This will be used as the op_name for the call. Anonymous operations (strings not referring to published ops) are supported.
+ - `inputs` (dict[str, Any]): A dictionary of input parameters for the operation.
+ - `output` (Any): The output/result of the operation.
+ - `parent` (Call | None): Optional parent call to nest this call under. If not provided, the call will be a root-level call (or nested under the current call context if one exists). Defaults to None.
+ - `attributes` (dict[str, Any] | None): Optional metadata to attach to the call. These are frozen once the call is created. Defaults to None.
+ - `display_name` (str | Callable[[Call], str] | None): Optional display name for the call in the UI. Can be a string or a callable that takes the call and returns a string. Defaults to None.
+ - `use_stack` (bool): Whether to push the call onto the runtime stack. When True, the call will be available in the call context and can be accessed via weave.require_current_call(). When False, the call is logged but not added to the call stack. Defaults to True.
+ - `exception` (BaseException | None): Optional exception to log if the operation failed. Defaults to None.
-```python
-sort_by(field: 'str', direction: 'SortDirection') → SavedView
-```
+**Returns:**
+
+ - `Call` : The created and finished Call object with full trace information.
----
+**Examples:**
+ Basic usage:
-
+```python
+import weave
+ >>> weave.init('my-project')
+ >>> call = weave.log_call(
+ ... op="my_function",
+ ... inputs={"x": 5, "y": 10},
+ ... output=15
+ ... )
+
+ Logging with attributes and display name:
+ >>> call = weave.log_call(
+ ... op="process_data",
+ ... inputs={"data": [1, 2, 3]},
+ ... output={"mean": 2.0},
+ ... attributes={"version": "1.0", "env": "prod"},
+ ... display_name="Data Processing"
+ ... )
+
+ Logging a failed operation:
+ >>> try:
+ ... result = risky_operation()
+ ... except Exception as e:
+ ... call = weave.log_call(
+ ... op="risky_operation",
+ ... inputs={},
+ ... output=None,
+ ... exception=e
+ ... )
+
+ Nesting calls:
+ >>> parent_call = weave.log_call("parent", {"input": 1}, 2)
+ >>> child_call = weave.log_call(
+ ... "child",
+ ... {"input": 2},
+ ... 4,
+ ... parent=parent_call
+ ... )
+
+ Logging without adding to call stack:
+ >>> call = weave.log_call(
+ ... op="background_task",
+ ... inputs={"task_id": 123},
+ ... output="completed",
+ ... use_stack=False # Don't push to call stack
+ ... )
+
+---
+
+
-### method `to_grid`
+### function `op`
```python
-to_grid(limit: 'int | None' = None) → Grid
+op(
+ func: 'Callable[P, R] | None' = None,
+ name: 'str | None' = None,
+ call_display_name: 'str | CallDisplayNameFunc | None' = None,
+ postprocess_inputs: 'PostprocessInputsFunc | None' = None,
+ postprocess_output: 'PostprocessOutputFunc | None' = None,
+ tracing_sample_rate: 'float' = 1.0,
+ enable_code_capture: 'bool' = True,
+ accumulator: 'Callable[[Any | None, Any], Any] | None' = None,
+ kind: 'OpKind | None' = None,
+ color: 'OpColor | None' = None
+) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]
```
+A decorator to weave op-ify a function or method. Works for both sync and async. Automatically detects iterator functions and applies appropriate behavior.
+
---
-
+
-### method `to_rich_table_str`
+### function `publish`
```python
-to_rich_table_str() → str
+publish(obj: 'Any', name: 'str | None' = None) → ObjectRef
```
----
-
-
-
-### method `ui_url`
+Save and version a Python object.
-```python
-ui_url() → str | None
-```
+Weave creates a new version of the object if the object's name already exists and its content hash does not match the latest version of that object.
-URL to show this saved view in the UI.
+**Args:**
+
-Note this is the "result" page with traces etc, not the URL for the view object.
+ - `obj` : The object to save and version.
+ - `name` : The name to save the object under.
+**Returns:**
+ A Weave Ref to the saved object.
---
-
+
-### method `unpin_column`
+### function `ref`
```python
-unpin_column(col_name: 'str') → SavedView
+ref(location: 'str') → ObjectRef
```
----
+Creates a Ref to an existing Weave object. This does not directly retrieve the object but allows you to pass it to other Weave API functions.
-
+**Args:**
+
-## class `Audio`
-A class representing audio data in a supported format (wav or mp3).
+ - `location` : A Weave Ref URI, or if `weave.init()` has been called, `name:version` or `name`. If no version is provided, `latest` is used.
+**Returns:**
+ A Weave Ref to the object.
-This class handles audio data storage and provides methods for loading from different sources and exporting to files.
+---
-**Attributes:**
-
- - `format` : The audio format (currently supports 'wav' or 'mp3')
- - `data` : The raw audio data as bytes
+
-**Args:**
-
+### function `require_current_call`
- - `data` : The audio data (bytes or base64 encoded string)
- - `format` : The audio format ('wav' or 'mp3')
- - `validate_base64` : Whether to attempt base64 decoding of the input data
-**Raises:**
-
- - `ValueError` : If audio data is empty or format is not supported
+```python
+require_current_call() → Call
+```
-
+Get the Call object for the currently executing Op, within that Op.
-### method `__init__`
+This allows you to access attributes of the Call such as its id or feedback while it is running.
```python
-__init__(
- data: 'bytes',
- format: 'SUPPORTED_FORMATS_TYPE',
- validate_base64: 'bool' = True
-) → None
+@weave.op
+def hello(name: str) -> None:
+ print(f"Hello {name}!")
+ current_call = weave.require_current_call()
+ print(current_call.id)
```
----
+It is also possible to access a Call after the Op has returned.
+
+If you have the Call's id, perhaps from the UI, you can use the `get_call` method on the `WeaveClient` returned from `weave.init` to retrieve the Call object.
-
+```python
+client = weave.init("")
+mycall = client.get_call("")
+```
-### method `export`
+Alternately, after defining your Op you can use its `call` method. For example:
```python
-export(path: 'str | bytes | Path | PathLike') → None
+@weave.op
+def add(a: int, b: int) -> int:
+ return a + b
+
+result, call = add.call(1, 2)
+print(call.id)
```
-Export audio data to a file.
+**Returns:**
+ The Call object for the currently executing Op
-**Args:**
+**Raises:**
+ - `NoCurrentCallError` : If tracking has not been initialized or this method is invoked outside an Op.
---
-
+
-### classmethod `from_data`
+### function `set_view`
```python
-from_data(data: 'str | bytes', format: 'str') → Audio
+set_view(
+ name: 'str',
+ content: 'Content | str',
+ extension: 'str | None' = None,
+ mimetype: 'str | None' = None,
+ metadata: 'dict[str, Any] | None' = None,
+ encoding: 'str' = 'utf-8'
+) → None
```
-Create an Audio object from raw data and specified format.
+Attach a custom view to the current call summary at `_weave.views.`.
- - `path` : Path where the audio file should be written
**Args:**
- - `data` : Audio data as bytes or base64 encoded string
- - `format` : Audio format ('wav' or 'mp3')
+ - `name` : The view name (key under `summary._weave.views`).
+ - `content` : A `weave.Content` instance or raw string. Strings are wrapped via `Content.from_text` using the supplied extension or mimetype.
+ - `extension` : Optional file extension to use when `content` is a string.
+ - `mimetype` : Optional MIME type to use when `content` is a string.
+ - `metadata` : Optional metadata to attach when creating `Content` from text.
+ - `encoding` : Text encoding to apply when creating `Content` from text.
**Returns:**
-
- - `Audio` : A new Audio instance
+ None
-**Raises:**
-
- - `ValueError` : If format is not supported
+**Examples:**
+ ``` import weave```
+ >>> weave.init("proj")
+ >>> @weave.op
+ ... def foo():
+ ... weave.set_view("readme", "# Hello", extension="md")
+ ... return 1
+ >>> foo()
---
-
+
-### classmethod `from_path`
+### function `thread`
```python
-from_path(path: 'str | bytes | Path | PathLike') → Audio
+thread(
+ thread_id: 'str | None | object' =
+) → Iterator[ThreadContext]
```
-Create an Audio object from a file path.
+Context manager for setting thread_id on calls within the context.
+
+**Examples:**
+```python
+# Auto-generate thread_id
+with weave.thread() as t:
+ print(f"Thread ID: {t.thread_id}")
+ result = my_function("input") # This call will have the auto-generated thread_id
+ print(f"Current turn: {t.turn_id}")
+
+# Explicit thread_id
+with weave.thread("custom_thread") as t:
+ result = my_function("input") # This call will have thread_id="custom_thread"
+
+# Disable threading
+with weave.thread(None) as t:
+ result = my_function("input") # This call will have thread_id=None
+```
**Args:**
- - `path` : Path to an audio file (must have .wav or .mp3 extension)
-**Returns:**
+ - `thread_id` : The thread identifier to associate with calls in this context. If not provided, a UUID v7 will be auto-generated. If None, thread tracking will be disabled.
+**Yields:**
- - `Audio` : A new Audio instance loaded from the file
+ - `ThreadContext` : An object providing access to thread_id and current turn_id.
+
+---
+
+
+
+### function `wandb_init_hook`
+
+```python
+wandb_init_hook() → None
+```
-**Raises:**
-
- - `ValueError` : If file doesn't exist or has unsupported extension
diff --git a/weave/reference/python-sdk/trace/feedback.mdx b/weave/reference/python-sdk/trace/feedback.mdx
index 2c63b36097..5318ee0c87 100644
--- a/weave/reference/python-sdk/trace/feedback.mdx
+++ b/weave/reference/python-sdk/trace/feedback.mdx
@@ -3,84 +3,84 @@ title: "feedback"
description: "Python SDK reference for weave.trace.feedback"
---
+import { SourceLink } from '/snippets/en/_includes/source-link.mdx';
+
# API Overview
---
-
+
-## class `Feedbacks`
-A collection of Feedback objects with utilities.
+## class `FeedbackQuery`
+Lazy-loading object for fetching feedback from the server.
-
+
### method `__init__`
```python
__init__(
- show_refs: 'bool',
- feedbacks: 'Iterable[Feedback] | None' = None
-) → None
+ entity: 'str',
+ project: 'str',
+ query: 'Query',
+ offset: 'int | None' = None,
+ limit: 'int | None' = None,
+ show_refs: 'bool' = False
+)
```
---
-
+
-### method `refs`
+### method `execute`
```python
-refs() → Refs
+execute() → Feedbacks
```
-Return the unique refs associated with these feedbacks.
-
---
-
+
-## class `FeedbackQuery`
-Lazy-loading object for fetching feedback from the server.
-
-
-
-### method `__init__`
+### method `refresh`
```python
-__init__(
- entity: 'str',
- project: 'str',
- query: 'Query',
- offset: 'int | None' = None,
- limit: 'int | None' = None,
- show_refs: 'bool' = False
-)
+refresh() → Feedbacks
```
---
-
+
-### method `execute`
+### method `refs`
```python
-execute() → Feedbacks
+refs() → Refs
```
---
-
+
-### method `refresh`
+## class `Feedbacks`
+A collection of Feedback objects with utilities.
+
+
+
+### method `__init__`
```python
-refresh() → Feedbacks
+__init__(
+ show_refs: 'bool',
+ feedbacks: 'Iterable[Feedback] | None' = None
+) → None
```
---
-
+
### method `refs`
@@ -88,14 +88,16 @@ refresh() → Feedbacks
refs() → Refs
```
+Return the unique refs associated with these feedbacks.
+
---
-
+
## class `RefFeedbackQuery`
Object for interacting with feedback associated with a particular ref.
-
+
### method `__init__`
@@ -105,7 +107,7 @@ __init__(ref: 'str') → None
---
-
+
### method `add`
@@ -125,7 +127,7 @@ feedback_type: A string identifying the type of feedback. The "wandb." prefix is
---
-
+
### method `add_note`
@@ -135,7 +137,7 @@ add_note(note: 'str', creator: 'str | None' = None) → str
---
-
+
### method `add_reaction`
@@ -145,7 +147,7 @@ add_reaction(emoji: 'str', creator: 'str | None' = None) → str
---
-
+
### method `execute`
@@ -155,7 +157,7 @@ execute() → Feedbacks
---
-
+
### method `purge`
@@ -165,7 +167,7 @@ purge(feedback_id: 'str') → None
---
-
+
### method `refresh`
@@ -175,7 +177,7 @@ refresh() → Feedbacks
---
-
+
### method `refs`
diff --git a/weave/reference/python-sdk/trace/op.mdx b/weave/reference/python-sdk/trace/op.mdx
index 8c454c5cd1..79f9c35f02 100644
--- a/weave/reference/python-sdk/trace/op.mdx
+++ b/weave/reference/python-sdk/trace/op.mdx
@@ -3,12 +3,75 @@ title: "op"
description: "Python SDK reference for weave.trace.op"
---
+import { SourceLink } from '/snippets/en/_includes/source-link.mdx';
+
# API Overview
---
-
+
+
+## class `DisplayNameFuncError`
+
+---
+
+
+
+## class `OpCallError`
+
+---
+
+
+
+## class `OpKwargs`
+TypedDict for op() keyword arguments.
+
+---
+
+
+
+## class `Sentinel`
+Sentinel(package: 'str', path: 'str', name: 'str')
+
+
+
+### method `__init__`
+
+```python
+__init__(package: 'str', path: 'str', name: 'str') → None
+```
+
+---
+
+
+
+## class `WeaveKwargs`
+
+---
+
+
+
+### function `as_op`
+
+```python
+as_op(fn: 'Callable[P, R]') → Op[P, R]
+```
+
+Given a @weave.op decorated function, return its Op.
+
+@weave.op decorated functions are instances of Op already, so this function should be a no-op at runtime. But you can use it to satisfy type checkers if you need to access OpDef attributes in a typesafe way.
+
+**Args:**
+
+
+ - `fn` : A weave.op decorated function.
+**Returns:**
+ The Op of the function.
+
+---
+
+
### function `call`
@@ -39,7 +102,7 @@ result, call = add.call(1, 2)
---
-
+
### function `calls`
@@ -60,3 +123,145 @@ calls = add.calls()
for call in calls:
print(call)
```
+
+---
+
+
+
+### function `get_captured_code`
+
+```python
+get_captured_code(op: 'Op') → str
+```
+
+Get the captured code of the op.
+
+This only works when you get an op back from a ref. The pattern is:
+
+ref = weave.publish(func) op = ref.get() captured_code = op.get_captured_code()
+
+---
+
+
+
+### function `is_op`
+
+```python
+is_op(obj: 'Any') → TypeIs[Op]
+```
+
+Check if an object is an Op.
+
+---
+
+
+
+### function `is_placeholder_call`
+
+```python
+is_placeholder_call(call: 'Call') → TypeIs[NoOpCall]
+```
+
+---
+
+
+
+### function `is_tracing_setting_disabled`
+
+```python
+is_tracing_setting_disabled() → bool
+```
+
+---
+
+
+
+### function `maybe_bind_method`
+
+```python
+maybe_bind_method(func: 'Callable', self: 'Any' = None) → Callable | MethodType
+```
+
+Bind a function to any object (even if it's not a class).
+
+If self is None, return the function as is.
+
+---
+
+
+
+### function `maybe_unbind_method`
+
+```python
+maybe_unbind_method(oplike: 'Op | MethodType | partial') → Op
+```
+
+Unbind an Op-like method or partial to a plain Op function.
+
+For:
+- methods, remove set `self` param
+- partials, remove any preset params
+
+---
+
+
+
+### function `op`
+
+```python
+op(
+ func: 'Callable[P, R] | None' = None,
+ name: 'str | None' = None,
+ call_display_name: 'str | CallDisplayNameFunc | None' = None,
+ postprocess_inputs: 'PostprocessInputsFunc | None' = None,
+ postprocess_output: 'PostprocessOutputFunc | None' = None,
+ tracing_sample_rate: 'float' = 1.0,
+ enable_code_capture: 'bool' = True,
+ accumulator: 'Callable[[Any | None, Any], Any] | None' = None,
+ kind: 'OpKind | None' = None,
+ color: 'OpColor | None' = None
+) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]
+```
+
+A decorator to weave op-ify a function or method. Works for both sync and async. Automatically detects iterator functions and applies appropriate behavior.
+
+---
+
+
+
+### function `placeholder_call`
+
+```python
+placeholder_call() → Call
+```
+
+---
+
+
+
+### function `setup_dunder_weave_dict`
+
+```python
+setup_dunder_weave_dict(op: 'Op', d: 'WeaveKwargs | None' = None) → WeaveKwargs
+```
+
+Sets up a __weave dict used to pass WeaveKwargs to ops.
+
+**Args:**
+
+
+ - `d` : Optional existing WeaveKwargs dict to update.
+ - `op` : Op to extract kind and color from.
+**Returns:**
+ WeaveKwargs dict with attributes, display_name, and optionally kind/color set.
+
+---
+
+
+
+### function `should_skip_tracing_for_op`
+
+```python
+should_skip_tracing_for_op(op: 'Op') → bool
+```
+
diff --git a/weave/reference/python-sdk/trace/util.mdx b/weave/reference/python-sdk/trace/util.mdx
index e849391cda..d8075b2f0f 100644
--- a/weave/reference/python-sdk/trace/util.mdx
+++ b/weave/reference/python-sdk/trace/util.mdx
@@ -3,12 +3,88 @@ title: "util"
description: "Python SDK reference for weave.trace.util"
---
+import { SourceLink } from '/snippets/en/_includes/source-link.mdx';
+
# API Overview
---
-
+
+
+## class `ContextAwareThread`
+A Thread that runs functions with the context of the caller.
+
+This is a drop-in replacement for threading.Thread that ensures calls behave as expected inside the thread. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this thread "just works" as the user probably expects.
+
+You can achieve the same effect without this class by instead writing:
+
+```python
+def run_with_context(func, *args, **kwargs):
+ context = copy_context()
+ def wrapper():
+ context.run(func, *args, **kwargs)
+ return wrapper
+
+thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs))
+thread.start()
+```
+
+
+
+### method `__init__`
+
+```python
+__init__(*args: 'Any', **kwargs: 'Any') → None
+```
+
+---
+
+#### property daemon
+
+A boolean value indicating whether this thread is a daemon thread.
+
+This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.
+
+The entire Python program exits when only daemon threads are left.
+
+---
+
+#### property ident
+
+Thread identifier of this thread or None if it has not been started.
+
+This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited.
+
+---
+
+#### property name
+
+A string used for identification purposes only.
+
+It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
+
+---
+
+#### property native_id
+
+Native integral thread ID of this thread, or None if it has not been started.
+
+This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel.
+
+---
+
+
+
+### method `run`
+
+```python
+run() → None
+```
+
+---
+
+
## class `ContextAwareThreadPoolExecutor`
A ThreadPoolExecutor that runs functions with the context of the caller.
@@ -27,7 +103,7 @@ with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(_wrapped_fn, vals)
```
-
+
### method `__init__`
@@ -37,7 +113,7 @@ __init__(*args: 'Any', **kwargs: 'Any') → None
---
-
+
### method `map`
@@ -52,7 +128,7 @@ map(
---
-
+
### method `submit`
@@ -62,7 +138,7 @@ submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any
---
-
+
## class `ContextAwareThread`
A Thread that runs functions with the context of the caller.
@@ -82,7 +158,7 @@ thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs))
thread.start()
```
-
+
### method `__init__`
@@ -126,7 +202,7 @@ This is a non-negative integer. See the get_native_id() function. This represent
---
-
+
### method `run`
@@ -134,3 +210,112 @@ This is a non-negative integer. See the get_native_id() function. This represent
run() → None
```
+---
+
+
+
+## class `ContextAwareThreadPoolExecutor`
+A ThreadPoolExecutor that runs functions with the context of the caller.
+
+This is a drop-in replacement for concurrent.futures.ThreadPoolExecutor that ensures weave calls behave as expected inside the executor. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this executor "just works" as the user probably expects.
+
+You can achieve the same effect without this class by instead writing:
+
+```python
+with concurrent.futures.ThreadPoolExecutor() as executor:
+ contexts = [copy_context() for _ in range(len(vals))]
+
+ def _wrapped_fn(*args):
+ return contexts.pop().run(fn, *args)
+
+ executor.map(_wrapped_fn, vals)
+```
+
+
+
+### method `__init__`
+
+```python
+__init__(*args: 'Any', **kwargs: 'Any') → None
+```
+
+---
+
+
+
+### method `map`
+
+```python
+map(
+ fn: 'Callable',
+ *iterables: 'Iterable[Any]',
+ timeout: 'float | None' = None,
+ chunksize: 'int' = 1
+) → Iterator
+```
+
+---
+
+
+
+### method `submit`
+
+```python
+submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any
+```
+
+---
+
+
+
+### function `deprecated`
+
+```python
+deprecated(new_name: 'str') → Callable[[Callable[, Any]], Callable[, Any]]
+```
+
+Decorator to mark a function as deprecated and redirect users to `new_name`.
+
+---
+
+
+
+### function `is_colab`
+
+```python
+is_colab()
+```
+
+---
+
+
+
+### function `is_notebook`
+
+```python
+is_notebook() → bool
+```
+
+---
+
+
+
+### function `log_once`
+
+```python
+log_once(log_method: 'Callable[[str], None]', message: 'str') → None
+```
+
+Logs a message once, suppressing subsequent messages of the same type. This is useful for notifying the user about errors without spamming the logs.
+
+This is mostly useful for cases where the same error message might occur many times. For example, if an op fails to save, it is likely going to happen every time that op is called. Or, if we have an error in our patched iterator, then it likely happens every time we iterate over the result. This allows use to inform the user about the error without clogging up their logs.
+
+**Args:**
+
+
+ - `log_method` : The method to use to log the message. This should accept a string argument.
+ - `message` : The message to log.
+**Example:**
+```python
+log_once(logger.error, "Failed to save op")
+```
diff --git a/weave/reference/python-sdk/trace/weave_client.mdx b/weave/reference/python-sdk/trace/weave_client.mdx
index 81b55842fd..07f1eaa7a9 100644
--- a/weave/reference/python-sdk/trace/weave_client.mdx
+++ b/weave/reference/python-sdk/trace/weave_client.mdx
@@ -3,16 +3,32 @@ title: "weave_client"
description: "Python SDK reference for weave.trace.weave_client"
---
+import { SourceLink } from '/snippets/en/_includes/source-link.mdx';
+
# API Overview
---
-
+
+
+## class `FlushStatus`
+Status information about the current flush operation.
+
+---
+
+
+
+## class `PendingJobCounts`
+Counts of pending jobs for each type.
+
+---
+
+
## class `WeaveClient`
-
+
### method `__init__`
@@ -39,7 +55,7 @@ This property can be used to check the progress of background tasks without bloc
---
-
+
### method `add_cost`
@@ -78,30 +94,30 @@ client.add_cost(llm_id="my_expensive_custom_model", prompt_token_cost=500, compl
---
-
+
-### method `call`
+### method `clear_wandb_run_context`
```python
-call(call_id: 'str', include_costs: 'bool' = False) → WeaveObject
+clear_wandb_run_context() → None
```
----
-
-
+Clear wandb run context override.
-### method `calls`
+After calling this, calls will fall back to using the global wandb.run (if available) for run_id and step information.
+**Examples:**
```python
-calls(
- filter: 'CallsFilter | None' = None,
- include_costs: 'bool' = False
-) → CallsIter
+client = weave.init("my-project")
+client.set_wandb_run_context(run_id="my-run-id", step=5)
+# ... make some calls ...
+client.clear_wandb_run_context()
+# Now calls will use global wandb.run again
```
---
-
+
### method `create_call`
@@ -133,7 +149,7 @@ Create, log, and push a call onto the runtime stack.
---
-
+
### method `delete_all_object_versions`
@@ -152,7 +168,7 @@ Delete all versions of an object.
---
-
+
### method `delete_all_op_versions`
@@ -171,7 +187,7 @@ Delete all versions of an op.
---
-
+
### method `delete_call`
@@ -181,7 +197,7 @@ delete_call(call: 'Call') → None
---
-
+
### method `delete_calls`
@@ -198,7 +214,7 @@ Deleting a call will also delete all of its children.
---
-
+
### method `delete_object_version`
@@ -208,7 +224,7 @@ delete_object_version(object: 'ObjectRef') → None
---
-
+
### method `delete_object_versions`
@@ -229,7 +245,7 @@ Delete specific versions of an object.
---
-
+
### method `delete_op_version`
@@ -239,7 +255,7 @@ delete_op_version(op: 'OpRef') → None
---
-
+
### method `fail_call`
@@ -251,22 +267,7 @@ Fail a call with an exception. This is a convenience method for finish_call.
---
-
-
-### method `feedback`
-
-```python
-feedback(
- query: 'Query | str | None' = None,
- reaction: 'str | None' = None,
- offset: 'int' = 0,
- limit: 'int' = 100
-) → FeedbackQuery
-```
-
----
-
-
+
### method `finish`
@@ -286,7 +287,7 @@ This method blocks until all currently enqueued jobs are processed, displaying a
---
-
+
### method `finish_call`
@@ -305,7 +306,7 @@ Any values present in ``call.summary`` are deep-merged with computed summary sta
---
-
+
### method `flush`
@@ -317,7 +318,7 @@ Flushes background asynchronous tasks, safe to call multiple times.
---
-
+
### method `get`
@@ -327,7 +328,7 @@ get(ref: 'ObjectRef', objectify: 'bool' = True) → Any
---
-
+
### method `get_call`
@@ -356,7 +357,7 @@ Get a single call by its ID.
---
-
+
### method `get_calls`
@@ -369,6 +370,8 @@ get_calls(
query: 'QueryLike | None' = None,
include_costs: 'bool' = False,
include_feedback: 'bool' = False,
+ include_storage_size: 'bool' = False,
+ include_total_storage_size: 'bool' = False,
columns: 'list[str] | None' = None,
expand_columns: 'list[str] | None' = None,
return_expanded_column_values: 'bool' = True,
@@ -392,6 +395,8 @@ Performance Tip: Specify `columns` and use `filter` or `query` to reduce result
- ``query`` : A mongo-like expression for advanced filtering. Not all Mongo operators are supported.
- ``include_costs`` : If True, includes token/cost info in `summary.weave`.
- ``include_feedback`` : If True, includes feedback in `summary.weave.feedback`.
+ - ``include_storage_size`` : If True, includes the storage size for a call.
+ - ``include_total_storage_size`` : If True, includes the total storage size for a trace.
- ``columns`` : List of fields to return per call. Reducing this can significantly improve performance. (Some fields like `id`, `trace_id`, `op_name`, and `started_at` are always included.)
- ``scored_by`` : Filter by one or more scorers (name or ref URI). Multiple scorers are AND-ed.
- ``page_size`` : Number of calls fetched per page. Tune this for performance in large queries.
@@ -413,7 +418,7 @@ for call in calls:
---
-
+
### method `get_evaluation`
@@ -449,7 +454,7 @@ print(evaluation.name)
---
-
+
### method `get_evaluations`
@@ -474,7 +479,7 @@ for eval in evaluations:
---
-
+
### method `get_feedback`
@@ -528,7 +533,7 @@ client.get_feedback(query=query)
---
-
+
### method `purge_costs`
@@ -549,7 +554,7 @@ client.purge_costs(ids)
---
-
+
### method `query_costs`
@@ -588,7 +593,7 @@ client.query_costs(llm_ids=["gpt-4o-mini-2024-07-18"], limit=10)
---
-
+
### method `save`
@@ -609,188 +614,91 @@ Do not call directly, use weave.publish() instead.
---
-
-
-## class `Call`
-A Call represents a single operation executed as part of a trace.
-
-``attributes`` are frozen once the call is created. Use :func:`weave.attributes` or ``create_call(..., attributes=...)`` to populate metadata beforehand. The ``summary`` dictionary may be modified while the call is running; its contents are deep-merged with computed summary values when :meth:`WeaveClient.finish_call` is invoked.
+
-
-
-### method `__init__`
+### method `set_wandb_run_context`
```python
-__init__(
- _op_name: 'str | Future[str]',
- trace_id: 'str',
- project_id: 'str',
- parent_id: 'str | None',
- inputs: 'dict[str, Any]',
- id: 'str | None' = None,
- output: 'Any' = None,
- exception: 'str | None' = None,
- summary: 'dict[str, Any] | None' = <factory>,
- _display_name: 'str | Callable[[Call], str] | None' = None,
- attributes: 'dict[str, Any] | None' = None,
- started_at: 'datetime | None' = None,
- ended_at: 'datetime | None' = None,
- deleted_at: 'datetime | None' = None,
- thread_id: 'str | None' = None,
- turn_id: 'str | None' = None,
- wb_run_id: 'str | None' = None,
- wb_run_step: 'int | None' = None,
- wb_run_step_end: 'int | None' = None,
- _children: 'list[Call]' = <factory>,
- _feedback: 'RefFeedbackQuery | None' = None
-) → None
+set_wandb_run_context(run_id: 'str', step: 'int | None' = None) → None
```
----
-
-#### property display_name
-
----
-
-#### property feedback
-
----
-
-#### property func_name
+Override wandb run_id and step for calls created by this client.
-The decorated function's name that produced this call.
-
-This is different from `op_name` which is usually the ref of the op.
-
----
-
-#### property op_name
-
----
-
-#### property ref
-
----
-
-#### property ui_url
-
----
-
-
-
-### method `apply_scorer`
-
-```python
-apply_scorer(
- scorer: 'Op | Scorer',
- additional_scorer_kwargs: 'dict[str, Any] | None' = None
-) → ApplyScorerResult
-```
-
-`apply_scorer` is a method that applies a Scorer to a Call. This is useful for guarding application logic with a scorer and/or monitoring the quality of critical ops. Scorers are automatically logged to Weave as Feedback and can be used in queries & analysis.
+This allows you to associate Weave calls with a specific WandB run that is not bound to the global wandb.run symbol.
**Args:**
- - `scorer` : The Scorer to apply.
- - `additional_scorer_kwargs` : Additional kwargs to pass to the scorer. This is useful for passing in additional context that is not part of the call inputs.useful for passing in additional context that is not part of the call inputs.
-**Returns:**
- The result of the scorer application in the form of an `ApplyScorerResult`.
-
+ - `run_id` : The run ID (not including entity/project prefix). The client will automatically add the entity/project prefix.
+ - `step` : The step number to use for calls. If None, step will not be set.
+**Examples:**
```python
-class ApplyScorerSuccess:
-
- - ` result` : Any
-
- - ` score_call` : Call
-```
-
-Example usage:
+client = weave.init("my-project")
+client.set_wandb_run_context(run_id="my-run-id", step=5)
+# Now all calls will be associated with entity/project/my-run-id at step 5
-```python
-my_scorer = ... # construct a scorer
-prediction, prediction_call = my_op.call(input_data)
-result, score_call = prediction.apply_scorer(my_scorer)
+# Or without a step
+client.set_wandb_run_context(run_id="my-run-id")
+# Calls will be associated with entity/project/my-run-id with no step
```
---
-
+
-### method `children`
+### function `get_obj_name`
```python
-children(page_size: 'int' = 1000) → CallsIter
+get_obj_name(val: 'Any') → str
```
-Get the children of the call.
-
-**Args:**
-
-
- - `page_size` : Tune performance by changing the number of calls fetched at a time.
-**Returns:**
- An iterator of calls.
-
---
-
+
-### method `delete`
+### function `get_parallelism_settings`
```python
-delete() → bool
+get_parallelism_settings() → tuple[int | None, int | None]
```
-Delete the call.
-
---
-
+
-### method `remove_display_name`
+### function `map_to_refs`
```python
-remove_display_name() → None
+map_to_refs(obj: 'Any') → Any
```
---
-
-
-### method `set_display_name`
-
-```python
-set_display_name(name: 'str | None') → None
-```
-
-Set the display name for the call.
+
-**Args:**
-
+### function `print_call_link`
- - `name` : The display name to set for the call.
-**Example:**
```python
-result, call = my_function.call("World")
-call.set_display_name("My Custom Display Name")
+print_call_link(call: 'Call') → None
```
---
-
+
-### method `to_dict`
+### function `redact_sensitive_keys`
```python
-to_dict() → CallDict
+redact_sensitive_keys(obj: 'Any') → Any
```
---
-### function `PaginatedIterator`
+
+
+### function `sanitize_object_name`
```python
-PaginatedIterator(*args, **kwargs)
+sanitize_object_name(name: 'str') → str
```
diff --git a/weave/reference/python-sdk/trace_server/trace_server_interface.mdx b/weave/reference/python-sdk/trace_server/trace_server_interface.mdx
index 5e86827716..1c124e8a22 100644
--- a/weave/reference/python-sdk/trace_server/trace_server_interface.mdx
+++ b/weave/reference/python-sdk/trace_server/trace_server_interface.mdx
@@ -3,12 +3,14 @@ title: "trace_server_interface"
description: "Python SDK reference for weave.trace_server.trace_server_interface"
---
+import { SourceLink } from '/snippets/en/_includes/source-link.mdx';
+
# API Overview
---
-
+
## class `ActionsExecuteBatchReq`
@@ -17,30 +19,264 @@ description: "Python SDK reference for weave.trace_server.trace_server_interface
- `project_id`: ``
- `action_ref`: ``
- `call_ids`: `list[str]`
-- `wb_user_id`: `typing.Optional[str]`
-
-------
+- `wb_user_id`: `str | None`
---
-
+
## class `ActionsExecuteBatchRes`
-------
+---
+
+
+
+## class `AnnotationQueueAddCallsReq`
+Request to add calls to an annotation queue in batch.
+
+Extends AnnotationQueueAddCallsBody by adding queue_id for internal API usage.
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `call_ids`: `list[str]`
+- `display_fields`: `list[str]`
+- `queue_id`: ``
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `AnnotationQueueAddCallsRes`
+Response from adding calls to a queue.
+
+**Pydantic Fields:**
+
+- `added_count`: ``
+- `duplicates`: ``
+
+---
+
+
+
+## class `AnnotationQueueCreateReq`
+Request to create a new annotation queue.
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `name`: ``
+- `description`: ``
+- `scorer_refs`: `list[str]`
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `AnnotationQueueCreateRes`
+Response from creating an annotation queue.
+
+**Pydantic Fields:**
+
+- `id`: ``
+
+---
+
+
+
+## class `AnnotationQueueItemSchema`
+Schema for annotation queue item responses.
+
+**Pydantic Fields:**
+
+- `id`: ``
+- `project_id`: ``
+- `queue_id`: ``
+- `call_id`: ``
+- `call_started_at`: ``
+- `call_ended_at`: `datetime.datetime | None`
+- `call_op_name`: ``
+- `call_trace_id`: ``
+- `display_fields`: `list[str]`
+- `added_by`: `str | None`
+- `annotation_state`: `typing.Literal['unstarted', 'in_progress', 'completed', 'skipped']`
+- `annotator_user_id`: `str | None`
+- `created_at`: ``
+- `created_by`: ``
+- `updated_at`: ``
+- `deleted_at`: `datetime.datetime | None`
+- `position_in_queue`: `int | None`
+
+---
+
+
+
+## class `AnnotationQueueItemsQueryReq`
+Request to query items in an annotation queue.
+
+Extends AnnotationQueueItemsQueryBody by adding queue_id for internal API usage.
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `filter`: `weave.trace_server.common_interface.AnnotationQueueItemsFilter | None`
+- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None`
+- `limit`: `int | None`
+- `offset`: `int | None`
+- `include_position`: ``
+- `queue_id`: ``
+
+---
+
+
+
+## class `AnnotationQueueItemsQueryRes`
+Response from querying annotation queue items.
+
+**Pydantic Fields:**
+
+- `items`: `list[AnnotationQueueItemSchema]`
+
+---
+
+
+
+## class `AnnotationQueueReadReq`
+Request to read a specific annotation queue.
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `queue_id`: ``
+
+---
+
+
+
+## class `AnnotationQueueReadRes`
+Response from reading an annotation queue.
+
+**Pydantic Fields:**
+
+- `queue`: ``
+
+---
+
+
+
+## class `AnnotationQueueSchema`
+Schema for annotation queue responses.
+
+**Pydantic Fields:**
+
+- `id`: ``
+- `project_id`: ``
+- `name`: ``
+- `description`: ``
+- `scorer_refs`: `list[str]`
+- `created_at`: ``
+- `created_by`: ``
+- `updated_at`: ``
+- `deleted_at`: `datetime.datetime | None`
+
+---
+
+
+
+## class `AnnotationQueueStatsSchema`
+Statistics for a single annotation queue.
+
+**Pydantic Fields:**
+
+- `queue_id`: ``
+- `total_items`: ``
+- `completed_items`: ``
+
+---
+
+
+
+## class `AnnotationQueuesQueryReq`
+Request to query annotation queues for a project.
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `name`: `str | None`
+- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None`
+- `limit`: `int | None`
+- `offset`: `int | None`
+
+---
+
+
+
+## class `AnnotationQueuesQueryRes`
+Response from querying annotation queues.
+
+**Pydantic Fields:**
+
+- `queues`: `list[AnnotationQueueSchema]`
+
+---
+
+
+
+## class `AnnotationQueuesStatsReq`
+Request to get stats for multiple annotation queues.
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `queue_ids`: `list[str]`
+
+---
+
+
+
+## class `AnnotationQueuesStatsRes`
+Response with stats for multiple annotation queues.
+
+**Pydantic Fields:**
+
+- `stats`: `list[AnnotationQueueStatsSchema]`
+
+---
+
+
+
+## class `AnnotatorQueueItemsProgressUpdateReq`
+Request to update the annotation state of a queue item for the current annotator.
+
+Valid state transitions:
+- (absence) -> 'in_progress': Mark item as in progress (only when no record exists)
+- (absence) -> 'completed' or 'skipped': Directly complete/skip item
+- 'in_progress' or 'unstarted' -> 'completed' or 'skipped': Complete/skip started item
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `queue_id`: ``
+- `item_id`: ``
+- `annotation_state`: ``
+- `wb_user_id`: `str | None`
---
-
+
-## class `BaseModelStrict`
-Base model with strict validation that forbids extra fields.
+## class `AnnotatorQueueItemsProgressUpdateRes`
+Response from updating annotation state.
+
+**Pydantic Fields:**
-------
+- `item`: ``
---
-
+
## class `CallBatchEndMode`
@@ -49,11 +285,9 @@ Base model with strict validation that forbids extra fields.
- `mode`: ``
- `req`: ``
-------
-
---
-
+
## class `CallBatchStartMode`
@@ -62,35 +296,29 @@ Base model with strict validation that forbids extra fields.
- `mode`: ``
- `req`: ``
-------
-
---
-
+
## class `CallCreateBatchReq`
**Pydantic Fields:**
-- `batch`: `list[typing.Union[CallBatchStartMode, CallBatchEndMode]]`
-
-------
+- `batch`: `list[CallBatchStartMode | CallBatchEndMode]`
---
-
+
## class `CallCreateBatchRes`
**Pydantic Fields:**
-- `res`: `list[typing.Union[CallStartRes, CallEndRes]]`
-
-------
+- `res`: `list[CallStartRes | CallEndRes]`
---
-
+
## class `CallEndReq`
@@ -98,19 +326,15 @@ Base model with strict validation that forbids extra fields.
- `end`: ``
-------
-
---
-
+
## class `CallEndRes`
-------
-
---
-
+
## class `CallReadReq`
@@ -118,27 +342,23 @@ Base model with strict validation that forbids extra fields.
- `project_id`: ``
- `id`: ``
-- `include_costs`: `typing.Optional[bool]`
-- `include_storage_size`: `typing.Optional[bool]`
-- `include_total_storage_size`: `typing.Optional[bool]`
-
-------
+- `include_costs`: `bool | None`
+- `include_storage_size`: `bool | None`
+- `include_total_storage_size`: `bool | None`
---
-
+
## class `CallReadRes`
**Pydantic Fields:**
-- `call`: `typing.Optional[CallSchema]`
-
-------
+- `call`: `CallSchema | None`
---
-
+
## class `CallSchema`
@@ -147,29 +367,27 @@ Base model with strict validation that forbids extra fields.
- `id`: ``
- `project_id`: ``
- `op_name`: ``
-- `display_name`: `typing.Optional[str]`
+- `display_name`: `str | None`
- `trace_id`: ``
-- `parent_id`: `typing.Optional[str]`
-- `thread_id`: `typing.Optional[str]`
-- `turn_id`: `typing.Optional[str]`
+- `parent_id`: `str | None`
+- `thread_id`: `str | None`
+- `turn_id`: `str | None`
- `started_at`: ``
- `attributes`: `dict[str, typing.Any]`
- `inputs`: `dict[str, typing.Any]`
-- `ended_at`: `typing.Optional[datetime.datetime]`
-- `exception`: `typing.Optional[str]`
-- `output`: `typing.Optional[typing.Any]`
-- `summary`: `typing.Optional[SummaryMap]`
-- `wb_user_id`: `typing.Optional[str]`
-- `wb_run_id`: `typing.Optional[str]`
-- `wb_run_step`: `typing.Optional[int]`
-- `wb_run_step_end`: `typing.Optional[int]`
-- `deleted_at`: `typing.Optional[datetime.datetime]`
-- `storage_size_bytes`: `typing.Optional[int]`
-- `total_storage_size_bytes`: `typing.Optional[int]`
-
----------
-
-
+- `ended_at`: `datetime.datetime | None`
+- `exception`: `str | None`
+- `output`: `typing.Any | None`
+- `summary`: `SummaryMap | None`
+- `wb_user_id`: `str | None`
+- `wb_run_id`: `str | None`
+- `wb_run_step`: `int | None`
+- `wb_run_step_end`: `int | None`
+- `deleted_at`: `datetime.datetime | None`
+- `storage_size_bytes`: `int | None`
+- `total_storage_size_bytes`: `int | None`
+
+
### method `serialize_typed_dicts`
@@ -179,7 +397,7 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
---
-
+
## class `CallStartReq`
@@ -187,11 +405,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `start`: ``
-------
-
---
-
+
## class `CallStartRes`
@@ -200,11 +416,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `id`: ``
- `trace_id`: ``
-------
-
---
-
+
## class `CallUpdateReq`
@@ -212,22 +426,18 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `call_id`: ``
-- `display_name`: `typing.Optional[str]`
-- `wb_user_id`: `typing.Optional[str]`
-
-------
+- `display_name`: `str | None`
+- `wb_user_id`: `str | None`
---
-
+
## class `CallUpdateRes`
-------
-
---
-
+
## class `CallsDeleteReq`
@@ -235,67 +445,63 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `call_ids`: `list[str]`
-- `wb_user_id`: `typing.Optional[str]`
-
-------
+- `wb_user_id`: `str | None`
---
-
+
## class `CallsDeleteRes`
-------
+**Pydantic Fields:**
+
+- `num_deleted`: ``
---
-
+
## class `CallsFilter`
**Pydantic Fields:**
-- `op_names`: `typing.Optional[list[str]]`
-- `input_refs`: `typing.Optional[list[str]]`
-- `output_refs`: `typing.Optional[list[str]]`
-- `parent_ids`: `typing.Optional[list[str]]`
-- `trace_ids`: `typing.Optional[list[str]]`
-- `call_ids`: `typing.Optional[list[str]]`
-- `thread_ids`: `typing.Optional[list[str]]`
-- `turn_ids`: `typing.Optional[list[str]]`
-- `trace_roots_only`: `typing.Optional[bool]`
-- `wb_user_ids`: `typing.Optional[list[str]]`
-- `wb_run_ids`: `typing.Optional[list[str]]`
-
-------
+- `op_names`: `list[str] | None`
+- `input_refs`: `list[str] | None`
+- `output_refs`: `list[str] | None`
+- `parent_ids`: `list[str] | None`
+- `trace_ids`: `list[str] | None`
+- `call_ids`: `list[str] | None`
+- `thread_ids`: `list[str] | None`
+- `turn_ids`: `list[str] | None`
+- `trace_roots_only`: `bool | None`
+- `wb_user_ids`: `list[str] | None`
+- `wb_run_ids`: `list[str] | None`
---
-
+
## class `CallsQueryReq`
**Pydantic Fields:**
- `project_id`: ``
-- `filter`: `typing.Optional[CallsFilter]`
-- `limit`: `typing.Optional[int]`
-- `offset`: `typing.Optional[int]`
-- `sort_by`: `typing.Optional[list[SortBy]]`
-- `query`: `typing.Optional[weave.trace_server.interface.query.Query]`
-- `include_costs`: `typing.Optional[bool]`
-- `include_feedback`: `typing.Optional[bool]`
-- `include_storage_size`: `typing.Optional[bool]`
-- `include_total_storage_size`: `typing.Optional[bool]`
-- `columns`: `typing.Optional[list[str]]`
-- `expand_columns`: `typing.Optional[list[str]]`
-- `return_expanded_column_values`: `typing.Optional[bool]`
-
-------
+- `filter`: `CallsFilter | None`
+- `limit`: `int | None`
+- `offset`: `int | None`
+- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None`
+- `query`: `weave.trace_server.interface.query.Query | None`
+- `include_costs`: `bool | None`
+- `include_feedback`: `bool | None`
+- `include_storage_size`: `bool | None`
+- `include_total_storage_size`: `bool | None`
+- `columns`: `list[str] | None`
+- `expand_columns`: `list[str] | None`
+- `return_expanded_column_values`: `bool | None`
---
-
+
## class `CallsQueryRes`
@@ -303,41 +509,35 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `calls`: `list[CallSchema]`
-------
-
---
-
+
## class `CallsQueryStatsReq`
**Pydantic Fields:**
- `project_id`: ``
-- `filter`: `typing.Optional[CallsFilter]`
-- `query`: `typing.Optional[weave.trace_server.interface.query.Query]`
-- `limit`: `typing.Optional[int]`
-- `include_total_storage_size`: `typing.Optional[bool]`
-- `expand_columns`: `typing.Optional[list[str]]`
-
-------
+- `filter`: `CallsFilter | None`
+- `query`: `weave.trace_server.interface.query.Query | None`
+- `limit`: `int | None`
+- `include_total_storage_size`: `bool | None`
+- `expand_columns`: `list[str] | None`
---
-
+
## class `CallsQueryStatsRes`
**Pydantic Fields:**
- `count`: ``
-- `total_storage_size_bytes`: `typing.Optional[int]`
-
-------
+- `total_storage_size_bytes`: `int | None`
---
-
+
## class `CompletionsCreateReq`
@@ -345,14 +545,12 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `inputs`: ``
-- `wb_user_id`: `typing.Optional[str]`
-- `track_llm_call`: `typing.Optional[bool]`
-
-------
+- `wb_user_id`: `str | None`
+- `track_llm_call`: `bool | None`
---
-
+
## class `CompletionsCreateRequestInputs`
@@ -360,49 +558,47 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `model`: ``
- `messages`: ``
-- `timeout`: `typing.Union[float, str, NoneType]`
-- `temperature`: `typing.Optional[float]`
-- `top_p`: `typing.Optional[float]`
-- `n`: `typing.Optional[int]`
-- `stop`: `typing.Union[str, list, NoneType]`
-- `max_completion_tokens`: `typing.Optional[int]`
-- `max_tokens`: `typing.Optional[int]`
-- `modalities`: `typing.Optional[list]`
-- `presence_penalty`: `typing.Optional[float]`
-- `frequency_penalty`: `typing.Optional[float]`
-- `stream`: `typing.Optional[bool]`
-- `logit_bias`: `typing.Optional[dict]`
-- `user`: `typing.Optional[str]`
-- `response_format`: `typing.Union[dict, type[pydantic.main.BaseModel], NoneType]`
-- `seed`: `typing.Optional[int]`
-- `tools`: `typing.Optional[list]`
-- `tool_choice`: `typing.Union[str, dict, NoneType]`
-- `logprobs`: `typing.Optional[bool]`
-- `top_logprobs`: `typing.Optional[int]`
-- `parallel_tool_calls`: `typing.Optional[bool]`
-- `extra_headers`: `typing.Optional[dict]`
-- `functions`: `typing.Optional[list]`
-- `function_call`: `typing.Optional[str]`
-- `api_version`: `typing.Optional[str]`
-
-------
-
----
-
-
+- `timeout`: `float | str | None`
+- `temperature`: `float | None`
+- `top_p`: `float | None`
+- `n`: `int | None`
+- `stop`: `str | list | None`
+- `max_completion_tokens`: `int | None`
+- `max_tokens`: `int | None`
+- `modalities`: `list | None`
+- `presence_penalty`: `float | None`
+- `frequency_penalty`: `float | None`
+- `stream`: `bool | None`
+- `logit_bias`: `dict | None`
+- `user`: `str | None`
+- `response_format`: `dict | type[pydantic.main.BaseModel] | None`
+- `seed`: `int | None`
+- `tools`: `list | None`
+- `tool_choice`: `str | dict | None`
+- `logprobs`: `bool | None`
+- `top_logprobs`: `int | None`
+- `parallel_tool_calls`: `bool | None`
+- `extra_headers`: `dict | None`
+- `functions`: `list | None`
+- `function_call`: `str | None`
+- `api_version`: `str | None`
+- `prompt`: `str | None`
+- `template_vars`: `dict[str, typing.Any] | None`
+
+---
+
+
## class `CompletionsCreateRes`
**Pydantic Fields:**
- `response`: `dict[str, typing.Any]`
-- `weave_call_id`: `typing.Optional[str]`
-
-------
+- `weave_call_id`: `str | None`
---
-
+
## class `CostCreateInput`
@@ -410,16 +606,14 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `prompt_token_cost`: ``
- `completion_token_cost`: ``
-- `prompt_token_cost_unit`: `typing.Optional[str]`
-- `completion_token_cost_unit`: `typing.Optional[str]`
-- `effective_date`: `typing.Optional[datetime.datetime]`
-- `provider_id`: `typing.Optional[str]`
-
-------
+- `prompt_token_cost_unit`: `str | None`
+- `completion_token_cost_unit`: `str | None`
+- `effective_date`: `datetime.datetime | None`
+- `provider_id`: `str | None`
---
-
+
## class `CostCreateReq`
@@ -427,13 +621,11 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `costs`: `dict[str, CostCreateInput]`
-- `wb_user_id`: `typing.Optional[str]`
-
-------
+- `wb_user_id`: `str | None`
---
-
+
## class `CostCreateRes`
@@ -441,11 +633,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `ids`: `list[tuple[str, str]]`
-------
-
---
-
+
## class `CostPurgeReq`
@@ -454,55 +644,47 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `query`: ``
-------
-
---
-
+
## class `CostPurgeRes`
-------
-
---
-
+
## class `CostQueryOutput`
**Pydantic Fields:**
-- `id`: `typing.Optional[str]`
-- `llm_id`: `typing.Optional[str]`
-- `prompt_token_cost`: `typing.Optional[float]`
-- `completion_token_cost`: `typing.Optional[float]`
-- `prompt_token_cost_unit`: `typing.Optional[str]`
-- `completion_token_cost_unit`: `typing.Optional[str]`
-- `effective_date`: `typing.Optional[datetime.datetime]`
-- `provider_id`: `typing.Optional[str]`
-
-------
+- `id`: `str | None`
+- `llm_id`: `str | None`
+- `prompt_token_cost`: `float | None`
+- `completion_token_cost`: `float | None`
+- `prompt_token_cost_unit`: `str | None`
+- `completion_token_cost_unit`: `str | None`
+- `effective_date`: `datetime.datetime | None`
+- `provider_id`: `str | None`
---
-
+
## class `CostQueryReq`
**Pydantic Fields:**
- `project_id`: ``
-- `fields`: `typing.Optional[list[str]]`
-- `query`: `typing.Optional[weave.trace_server.interface.query.Query]`
-- `sort_by`: `typing.Optional[list[SortBy]]`
-- `limit`: `typing.Optional[int]`
-- `offset`: `typing.Optional[int]`
-
-------
+- `fields`: `list[str] | None`
+- `query`: `weave.trace_server.interface.query.Query | None`
+- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None`
+- `limit`: `int | None`
+- `offset`: `int | None`
---
-
+
## class `CostQueryRes`
@@ -510,195 +692,534 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `results`: `list[CostQueryOutput]`
-------
-
---
-
+
-## class `EndedCallSchemaForInsert`
+## class `DatasetCreateBody`
**Pydantic Fields:**
-- `project_id`: ``
-- `id`: ``
-- `ended_at`: ``
-- `exception`: `typing.Optional[str]`
-- `output`: `typing.Optional[typing.Any]`
-- `summary`: ``
-- `wb_run_step_end`: `typing.Optional[int]`
+- `name`: `str | None`
+- `description`: `str | None`
+- `rows`: `list[dict[str, typing.Any]]`
----------
+---
-
+
-### method `serialize_typed_dicts`
+## class `DatasetCreateReq`
-```python
-serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
-```
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `rows`: `list[dict[str, typing.Any]]`
+- `project_id`: ``
+- `wb_user_id`: `str | None`
---
-
+
-## class `EnsureProjectExistsRes`
+## class `DatasetCreateRes`
**Pydantic Fields:**
-- `project_name`: ``
-
-------
+- `digest`: ``
+- `object_id`: ``
+- `version_index`: ``
---
-
+
-## class `EvaluateModelReq`
+## class `DatasetDeleteReq`
**Pydantic Fields:**
- `project_id`: ``
-- `evaluation_ref`: ``
-- `model_ref`: ``
-- `wb_user_id`: `typing.Optional[str]`
-
-------
+- `object_id`: ``
+- `digests`: `list[str] | None`
+- `wb_user_id`: `str | None`
---
-
+
-## class `EvaluateModelRes`
+## class `DatasetDeleteRes`
**Pydantic Fields:**
-- `call_id`: ``
-
-------
+- `num_deleted`: ``
---
-
+
-## class `EvaluationStatusComplete`
+## class `DatasetListReq`
**Pydantic Fields:**
-- `code`: `typing.Literal['complete']`
-- `output`: `dict[str, typing.Any]`
-
-------
+- `project_id`: ``
+- `limit`: `int | None`
+- `offset`: `int | None`
+- `wb_user_id`: `str | None`
---
-
+
-## class `EvaluationStatusFailed`
+## class `DatasetReadReq`
**Pydantic Fields:**
-- `code`: `typing.Literal['failed']`
-- `error`: `typing.Optional[str]`
-
-------
+- `project_id`: ``
+- `object_id`: ``
+- `digest`: ``
+- `wb_user_id`: `str | None`
---
-
+
-## class `EvaluationStatusNotFound`
+## class `DatasetReadRes`
**Pydantic Fields:**
-- `code`: `typing.Literal['not_found']`
-
-------
+- `object_id`: ``
+- `digest`: ``
+- `version_index`: ``
+- `created_at`: ``
+- `name`: ``
+- `description`: `str | None`
+- `rows`: ``
---
-
+
-## class `EvaluationStatusReq`
+## class `EndedCallSchemaForInsert`
**Pydantic Fields:**
- `project_id`: ``
-- `call_id`: ``
+- `id`: ``
+- `ended_at`: ``
+- `exception`: `str | None`
+- `output`: `typing.Any | None`
+- `summary`: ``
+- `wb_run_step_end`: `int | None`
+
+
+
+### method `serialize_typed_dicts`
-------
+```python
+serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
+```
---
-
+
-## class `EvaluationStatusRes`
+## class `EnsureProjectExistsRes`
**Pydantic Fields:**
-- `status`: `typing.Union[EvaluationStatusNotFound, EvaluationStatusRunning, EvaluationStatusFailed, EvaluationStatusComplete]`
-
-------
+- `project_name`: ``
---
-
+
-## class `EvaluationStatusRunning`
+## class `EvaluateModelReq`
**Pydantic Fields:**
-- `code`: `typing.Literal['running']`
-- `completed_rows`: ``
-- `total_rows`: ``
-
-------
+- `project_id`: ``
+- `evaluation_ref`: ``
+- `model_ref`: ``
+- `wb_user_id`: `str | None`
---
-
+
-## class `ExportTracePartialSuccess`
+## class `EvaluateModelRes`
**Pydantic Fields:**
-- `rejected_spans`: ``
-- `error_message`: ``
-
-------
+- `call_id`: ``
---
-
+
-## class `ExtraKeysTypedDict`
+## class `EvaluationCreateBody`
+
+**Pydantic Fields:**
+
+- `name`: ``
+- `description`: `str | None`
+- `dataset`: ``
+- `scorers`: `list[str] | None`
+- `trials`: ``
+- `evaluation_name`: `str | None`
+- `eval_attributes`: `dict[str, typing.Any] | None`
---
-
+
-## class `Feedback`
+## class `EvaluationCreateReq`
**Pydantic Fields:**
-- `id`: ``
+- `name`: ``
+- `description`: `str | None`
+- `dataset`: ``
+- `scorers`: `list[str] | None`
+- `trials`: ``
+- `evaluation_name`: `str | None`
+- `eval_attributes`: `dict[str, typing.Any] | None`
- `project_id`: ``
-- `weave_ref`: ``
-- `creator`: `typing.Optional[str]`
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationCreateRes`
+
+**Pydantic Fields:**
+
+- `digest`: ``
+- `object_id`: ``
+- `version_index`: ``
+- `evaluation_ref`: ``
+
+---
+
+
+
+## class `EvaluationDeleteReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `object_id`: ``
+- `digests`: `list[str] | None`
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationDeleteRes`
+
+**Pydantic Fields:**
+
+- `num_deleted`: ``
+
+---
+
+
+
+## class `EvaluationListReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `limit`: `int | None`
+- `offset`: `int | None`
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationReadReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `object_id`: ``
+- `digest`: ``
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationReadRes`
+
+**Pydantic Fields:**
+
+- `object_id`: ``
+- `digest`: ``
+- `version_index`: ``
+- `created_at`: ``
+- `name`: ``
+- `description`: `str | None`
+- `dataset`: ``
+- `scorers`: `list[str]`
+- `trials`: ``
+- `evaluation_name`: `str | None`
+- `evaluate_op`: `str | None`
+- `predict_and_score_op`: `str | None`
+- `summarize_op`: `str | None`
+
+---
+
+
+
+## class `EvaluationRunCreateBody`
+
+**Pydantic Fields:**
+
+- `evaluation`: ``
+- `model`: ``
+
+---
+
+
+
+## class `EvaluationRunCreateReq`
+
+**Pydantic Fields:**
+
+- `evaluation`: ``
+- `model`: ``
+- `project_id`: ``
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationRunCreateRes`
+
+**Pydantic Fields:**
+
+- `evaluation_run_id`: ``
+
+---
+
+
+
+## class `EvaluationRunDeleteReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `evaluation_run_ids`: `list[str]`
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationRunDeleteRes`
+
+**Pydantic Fields:**
+
+- `num_deleted`: ``
+
+---
+
+
+
+## class `EvaluationRunFilter`
+
+**Pydantic Fields:**
+
+- `evaluations`: `list[str] | None`
+- `models`: `list[str] | None`
+- `evaluation_run_ids`: `list[str] | None`
+
+---
+
+
+
+## class `EvaluationRunFinishBody`
+Request body for finishing an evaluation run via REST API.
+
+This model excludes project_id and evaluation_run_id since they come from the URL path in RESTful endpoints.
+
+**Pydantic Fields:**
+
+- `summary`: `dict[str, typing.Any] | None`
+
+---
+
+
+
+## class `EvaluationRunFinishReq`
+
+**Pydantic Fields:**
+
+- `summary`: `dict[str, typing.Any] | None`
+- `project_id`: ``
+- `evaluation_run_id`: ``
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `EvaluationRunFinishRes`
+
+**Pydantic Fields:**
+
+- `success`: ``
+
+---
+
+
+
+## class `EvaluationRunListReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `filter`: `EvaluationRunFilter | None`
+- `limit`: `int | None`
+- `offset`: `int | None`
+
+---
+
+
+
+## class `EvaluationRunReadReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `evaluation_run_id`: ``
+
+---
+
+
+
+## class `EvaluationRunReadRes`
+
+**Pydantic Fields:**
+
+- `evaluation_run_id`: ``
+- `evaluation`: ``
+- `model`: ``
+- `status`: `str | None`
+- `started_at`: `datetime.datetime | None`
+- `finished_at`: `datetime.datetime | None`
+- `summary`: `dict[str, typing.Any] | None`
+
+---
+
+
+
+## class `EvaluationStatusComplete`
+
+**Pydantic Fields:**
+
+- `code`: `typing.Literal['complete']`
+- `output`: `dict[str, typing.Any]`
+
+---
+
+
+
+## class `EvaluationStatusFailed`
+
+**Pydantic Fields:**
+
+- `code`: `typing.Literal['failed']`
+- `error`: `str | None`
+
+---
+
+
+
+## class `EvaluationStatusNotFound`
+
+**Pydantic Fields:**
+
+- `code`: `typing.Literal['not_found']`
+
+---
+
+
+
+## class `EvaluationStatusReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `call_id`: ``
+
+---
+
+
+
+## class `EvaluationStatusRes`
+
+**Pydantic Fields:**
+
+- `status`: `EvaluationStatusNotFound | EvaluationStatusRunning | EvaluationStatusFailed | EvaluationStatusComplete`
+
+---
+
+
+
+## class `EvaluationStatusRunning`
+
+**Pydantic Fields:**
+
+- `code`: `typing.Literal['running']`
+- `completed_rows`: ``
+- `total_rows`: ``
+
+---
+
+
+
+## class `ExportTracePartialSuccess`
+
+**Pydantic Fields:**
+
+- `rejected_spans`: ``
+- `error_message`: ``
+
+---
+
+
+
+## class `ExtraKeysTypedDict`
+
+---
+
+
+
+## class `Feedback`
+
+**Pydantic Fields:**
+
+- `id`: ``
+- `project_id`: ``
+- `weave_ref`: ``
+- `creator`: `str | None`
- `feedback_type`: ``
- `payload`: `dict[str, typing.Any]`
-- `annotation_ref`: `typing.Optional[str]`
-- `runnable_ref`: `typing.Optional[str]`
-- `call_ref`: `typing.Optional[str]`
-- `trigger_ref`: `typing.Optional[str]`
-- `wb_user_id`: `typing.Optional[str]`
+- `annotation_ref`: `str | None`
+- `runnable_ref`: `str | None`
+- `call_ref`: `str | None`
+- `trigger_ref`: `str | None`
+- `wb_user_id`: `str | None`
- `created_at`: ``
-------
-
---
-
+
## class `FeedbackCreateBatchReq`
@@ -706,11 +1227,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `batch`: `list[FeedbackCreateReq]`
-------
-
---
-
+
## class `FeedbackCreateBatchRes`
@@ -718,33 +1237,29 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `res`: `list[FeedbackCreateRes]`
-------
-
---
-
+
## class `FeedbackCreateReq`
**Pydantic Fields:**
-- `id`: `typing.Optional[str]`
+- `id`: `str | None`
- `project_id`: ``
- `weave_ref`: ``
-- `creator`: `typing.Optional[str]`
+- `creator`: `str | None`
- `feedback_type`: ``
- `payload`: `dict[str, typing.Any]`
-- `annotation_ref`: `typing.Optional[str]`
-- `runnable_ref`: `typing.Optional[str]`
-- `call_ref`: `typing.Optional[str]`
-- `trigger_ref`: `typing.Optional[str]`
-- `wb_user_id`: `typing.Optional[str]`
-
-------
+- `annotation_ref`: `str | None`
+- `runnable_ref`: `str | None`
+- `call_ref`: `str | None`
+- `trigger_ref`: `str | None`
+- `wb_user_id`: `str | None`
---
-
+
## class `FeedbackCreateRes`
@@ -755,17 +1270,15 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `wb_user_id`: ``
- `payload`: `dict[str, typing.Any]`
-------
-
---
-
+
## class `FeedbackDict`
---
-
+
## class `FeedbackPurgeReq`
@@ -774,36 +1287,30 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `query`: ``
-------
-
---
-
+
## class `FeedbackPurgeRes`
-------
-
---
-
+
## class `FeedbackQueryReq`
**Pydantic Fields:**
- `project_id`: ``
-- `fields`: `typing.Optional[list[str]]`
-- `query`: `typing.Optional[weave.trace_server.interface.query.Query]`
-- `sort_by`: `typing.Optional[list[SortBy]]`
-- `limit`: `typing.Optional[int]`
-- `offset`: `typing.Optional[int]`
-
-------
+- `fields`: `list[str] | None`
+- `query`: `weave.trace_server.interface.query.Query | None`
+- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None`
+- `limit`: `int | None`
+- `offset`: `int | None`
---
-
+
## class `FeedbackQueryRes`
@@ -811,34 +1318,30 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `result`: `list[dict[str, typing.Any]]`
-------
-
---
-
+
## class `FeedbackReplaceReq`
**Pydantic Fields:**
-- `id`: `typing.Optional[str]`
+- `id`: `str | None`
- `project_id`: ``
- `weave_ref`: ``
-- `creator`: `typing.Optional[str]`
+- `creator`: `str | None`
- `feedback_type`: ``
- `payload`: `dict[str, typing.Any]`
-- `annotation_ref`: `typing.Optional[str]`
-- `runnable_ref`: `typing.Optional[str]`
-- `call_ref`: `typing.Optional[str]`
-- `trigger_ref`: `typing.Optional[str]`
-- `wb_user_id`: `typing.Optional[str]`
+- `annotation_ref`: `str | None`
+- `runnable_ref`: `str | None`
+- `call_ref`: `str | None`
+- `trigger_ref`: `str | None`
+- `wb_user_id`: `str | None`
- `feedback_id`: ``
-------
-
---
-
+
## class `FeedbackReplaceRes`
@@ -849,11 +1352,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `wb_user_id`: ``
- `payload`: `dict[str, typing.Any]`
-------
-
---
-
+
## class `FileContentReadReq`
@@ -862,11 +1363,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `project_id`: ``
- `digest`: ``
-------
-
---
-
+
## class `FileContentReadRes`
@@ -874,11 +1373,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `content`: ``
-------
-
---
-
+
## class `FileCreateReq`
@@ -888,493 +1385,2110 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any]
- `name`: ``
- `content`: ``
-------
+---
+
+
+
+## class `FileCreateRes`
+
+**Pydantic Fields:**
+
+- `digest`: ``
+
+---
+
+
+
+## class `FilesStatsReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+
+---
+
+
+
+## class `FilesStatsRes`
+
+**Pydantic Fields:**
+
+- `total_size_bytes`: ``
+
+---
+
+
+
+## class `FullTraceServerInterface`
+Complete trace server interface supporting both V1 and Object APIs.
+
+This protocol represents a trace server implementation that supports the full set of APIs - both legacy V1 endpoints and modern Object endpoints. Use this type for implementations that need to support both API versions.
+
+---
+
+
+
+### method `actions_execute_batch`
+
+```python
+actions_execute_batch(req: ActionsExecuteBatchReq) → ActionsExecuteBatchRes
+```
+
+---
+
+
+
+### method `annotation_queue_add_calls`
+
+```python
+annotation_queue_add_calls(
+ req: AnnotationQueueAddCallsReq
+) → AnnotationQueueAddCallsRes
+```
+
+---
+
+
+
+### method `annotation_queue_create`
+
+```python
+annotation_queue_create(
+ req: AnnotationQueueCreateReq
+) → AnnotationQueueCreateRes
+```
+
+---
+
+
+
+### method `annotation_queue_items_query`
+
+```python
+annotation_queue_items_query(
+ req: AnnotationQueueItemsQueryReq
+) → AnnotationQueueItemsQueryRes
+```
+
+---
+
+
+
+### method `annotation_queue_read`
+
+```python
+annotation_queue_read(req: AnnotationQueueReadReq) → AnnotationQueueReadRes
+```
+
+---
+
+
+
+### method `annotation_queues_query_stream`
+
+```python
+annotation_queues_query_stream(
+ req: AnnotationQueuesQueryReq
+) → Iterator[AnnotationQueueSchema]
+```
+
+---
+
+
+
+### method `annotation_queues_stats`
+
+```python
+annotation_queues_stats(
+ req: AnnotationQueuesStatsReq
+) → AnnotationQueuesStatsRes
+```
+
+---
+
+
+
+### method `annotator_queue_items_progress_update`
+
+```python
+annotator_queue_items_progress_update(
+ req: AnnotatorQueueItemsProgressUpdateReq
+) → AnnotatorQueueItemsProgressUpdateRes
+```
+
+---
+
+
+
+### method `call_end`
+
+```python
+call_end(req: CallEndReq) → CallEndRes
+```
+
+---
+
+
+
+### method `call_read`
+
+```python
+call_read(req: CallReadReq) → CallReadRes
+```
+
+---
+
+
+
+### method `call_start`
+
+```python
+call_start(req: CallStartReq) → CallStartRes
+```
+
+---
+
+
+
+### method `call_start_batch`
+
+```python
+call_start_batch(req: CallCreateBatchReq) → CallCreateBatchRes
+```
+
+---
+
+
+
+### method `call_update`
+
+```python
+call_update(req: CallUpdateReq) → CallUpdateRes
+```
+
+---
+
+
+
+### method `calls_delete`
+
+```python
+calls_delete(req: CallsDeleteReq) → CallsDeleteRes
+```
+
+---
+
+
+
+### method `calls_query`
+
+```python
+calls_query(req: CallsQueryReq) → CallsQueryRes
+```
+
+---
+
+
+
+### method `calls_query_stats`
+
+```python
+calls_query_stats(req: CallsQueryStatsReq) → CallsQueryStatsRes
+```
+
+---
+
+
+
+### method `calls_query_stream`
+
+```python
+calls_query_stream(req: CallsQueryReq) → Iterator[CallSchema]
+```
+
+---
+
+
+
+### method `completions_create`
+
+```python
+completions_create(req: CompletionsCreateReq) → CompletionsCreateRes
+```
+
+---
+
+
+
+### method `completions_create_stream`
+
+```python
+completions_create_stream(req: CompletionsCreateReq) → Iterator[dict[str, Any]]
+```
+
+---
+
+
+
+### method `cost_create`
+
+```python
+cost_create(req: CostCreateReq) → CostCreateRes
+```
+
+---
+
+
+
+### method `cost_purge`
+
+```python
+cost_purge(req: CostPurgeReq) → CostPurgeRes
+```
+
+---
+
+
+
+### method `cost_query`
+
+```python
+cost_query(req: CostQueryReq) → CostQueryRes
+```
+
+---
+
+
+
+### method `dataset_create`
+
+```python
+dataset_create(req: DatasetCreateReq) → DatasetCreateRes
+```
+
+---
+
+
+
+### method `dataset_delete`
+
+```python
+dataset_delete(req: DatasetDeleteReq) → DatasetDeleteRes
+```
+
+---
+
+
+
+### method `dataset_list`
+
+```python
+dataset_list(req: DatasetListReq) → Iterator[DatasetReadRes]
+```
+
+---
+
+
+
+### method `dataset_read`
+
+```python
+dataset_read(req: DatasetReadReq) → DatasetReadRes
+```
+
+---
+
+
+
+### method `ensure_project_exists`
+
+```python
+ensure_project_exists(entity: str, project: str) → EnsureProjectExistsRes
+```
+
+---
+
+
+
+### method `evaluate_model`
+
+```python
+evaluate_model(req: EvaluateModelReq) → EvaluateModelRes
+```
+
+---
+
+
+
+### method `evaluation_create`
+
+```python
+evaluation_create(req: EvaluationCreateReq) → EvaluationCreateRes
+```
+
+---
+
+
+
+### method `evaluation_delete`
+
+```python
+evaluation_delete(req: EvaluationDeleteReq) → EvaluationDeleteRes
+```
+
+---
+
+
+
+### method `evaluation_list`
+
+```python
+evaluation_list(req: EvaluationListReq) → Iterator[EvaluationReadRes]
+```
+
+---
+
+
+
+### method `evaluation_read`
+
+```python
+evaluation_read(req: EvaluationReadReq) → EvaluationReadRes
+```
+
+---
+
+
+
+### method `evaluation_run_create`
+
+```python
+evaluation_run_create(req: EvaluationRunCreateReq) → EvaluationRunCreateRes
+```
+
+---
+
+
+
+### method `evaluation_run_delete`
+
+```python
+evaluation_run_delete(req: EvaluationRunDeleteReq) → EvaluationRunDeleteRes
+```
+
+---
+
+
+
+### method `evaluation_run_finish`
+
+```python
+evaluation_run_finish(req: EvaluationRunFinishReq) → EvaluationRunFinishRes
+```
+
+---
+
+
+
+### method `evaluation_run_list`
+
+```python
+evaluation_run_list(req: EvaluationRunListReq) → Iterator[EvaluationRunReadRes]
+```
+
+---
+
+
+
+### method `evaluation_run_read`
+
+```python
+evaluation_run_read(req: EvaluationRunReadReq) → EvaluationRunReadRes
+```
+
+---
+
+
+
+### method `evaluation_status`
+
+```python
+evaluation_status(req: EvaluationStatusReq) → EvaluationStatusRes
+```
+
+---
+
+
+
+### method `feedback_create`
+
+```python
+feedback_create(req: FeedbackCreateReq) → FeedbackCreateRes
+```
+
+---
+
+
+
+### method `feedback_create_batch`
+
+```python
+feedback_create_batch(req: FeedbackCreateBatchReq) → FeedbackCreateBatchRes
+```
+
+---
+
+
+
+### method `feedback_purge`
+
+```python
+feedback_purge(req: FeedbackPurgeReq) → FeedbackPurgeRes
+```
+
+---
+
+
+
+### method `feedback_query`
+
+```python
+feedback_query(req: FeedbackQueryReq) → FeedbackQueryRes
+```
+
+---
+
+
+
+### method `feedback_replace`
+
+```python
+feedback_replace(req: FeedbackReplaceReq) → FeedbackReplaceRes
+```
+
+---
+
+
+
+### method `file_content_read`
+
+```python
+file_content_read(req: FileContentReadReq) → FileContentReadRes
+```
+
+---
+
+
+
+### method `file_create`
+
+```python
+file_create(req: FileCreateReq) → FileCreateRes
+```
+
+---
+
+
+
+### method `files_stats`
+
+```python
+files_stats(req: FilesStatsReq) → FilesStatsRes
+```
+
+---
+
+
+
+### method `image_create`
+
+```python
+image_create(req: ImageGenerationCreateReq) → ImageGenerationCreateRes
+```
+
+---
+
+
+
+### method `model_create`
+
+```python
+model_create(req: ModelCreateReq) → ModelCreateRes
+```
+
+---
+
+
+
+### method `model_delete`
+
+```python
+model_delete(req: ModelDeleteReq) → ModelDeleteRes
+```
+
+---
+
+
+
+### method `model_list`
+
+```python
+model_list(req: ModelListReq) → Iterator[ModelReadRes]
+```
+
+---
+
+
+
+### method `model_read`
+
+```python
+model_read(req: ModelReadReq) → ModelReadRes
+```
+
+---
+
+
+
+### method `obj_create`
+
+```python
+obj_create(req: ObjCreateReq) → ObjCreateRes
+```
+
+---
+
+
+
+### method `obj_delete`
+
+```python
+obj_delete(req: ObjDeleteReq) → ObjDeleteRes
+```
+
+---
+
+
+
+### method `obj_read`
+
+```python
+obj_read(req: ObjReadReq) → ObjReadRes
+```
+
+---
+
+
+
+### method `objs_query`
+
+```python
+objs_query(req: ObjQueryReq) → ObjQueryRes
+```
+
+---
+
+
+
+### method `op_create`
+
+```python
+op_create(req: OpCreateReq) → OpCreateRes
+```
+
+---
+
+
+
+### method `op_delete`
+
+```python
+op_delete(req: OpDeleteReq) → OpDeleteRes
+```
+
+---
+
+
+
+### method `op_list`
+
+```python
+op_list(req: OpListReq) → Iterator[OpReadRes]
+```
+
+---
+
+
+
+### method `op_read`
+
+```python
+op_read(req: OpReadReq) → OpReadRes
+```
+
+---
+
+
+
+### method `otel_export`
+
+```python
+otel_export(req: OtelExportReq) → OtelExportRes
+```
+
+---
+
+
+
+### method `prediction_create`
+
+```python
+prediction_create(req: PredictionCreateReq) → PredictionCreateRes
+```
+
+---
+
+
+
+### method `prediction_delete`
+
+```python
+prediction_delete(req: PredictionDeleteReq) → PredictionDeleteRes
+```
+
+---
+
+
+
+### method `prediction_finish`
+
+```python
+prediction_finish(req: PredictionFinishReq) → PredictionFinishRes
+```
+
+---
+
+
+
+### method `prediction_list`
+
+```python
+prediction_list(req: PredictionListReq) → Iterator[PredictionReadRes]
+```
+
+---
+
+
+
+### method `prediction_read`
+
+```python
+prediction_read(req: PredictionReadReq) → PredictionReadRes
+```
+
+---
+
+
+
+### method `project_stats`
+
+```python
+project_stats(req: ProjectStatsReq) → ProjectStatsRes
+```
+
+---
+
+
+
+### method `refs_read_batch`
+
+```python
+refs_read_batch(req: RefsReadBatchReq) → RefsReadBatchRes
+```
+
+---
+
+
+
+### method `score_create`
+
+```python
+score_create(req: ScoreCreateReq) → ScoreCreateRes
+```
+
+---
+
+
+
+### method `score_delete`
+
+```python
+score_delete(req: ScoreDeleteReq) → ScoreDeleteRes
+```
+
+---
+
+
+
+### method `score_list`
+
+```python
+score_list(req: ScoreListReq) → Iterator[ScoreReadRes]
+```
+
+---
+
+
+
+### method `score_read`
+
+```python
+score_read(req: ScoreReadReq) → ScoreReadRes
+```
+
+---
+
+
+
+### method `scorer_create`
+
+```python
+scorer_create(req: ScorerCreateReq) → ScorerCreateRes
+```
+
+---
+
+
+
+### method `scorer_delete`
+
+```python
+scorer_delete(req: ScorerDeleteReq) → ScorerDeleteRes
+```
+
+---
+
+
+
+### method `scorer_list`
+
+```python
+scorer_list(req: ScorerListReq) → Iterator[ScorerReadRes]
+```
+
+---
+
+
+
+### method `scorer_read`
+
+```python
+scorer_read(req: ScorerReadReq) → ScorerReadRes
+```
+
+---
+
+
+
+### method `table_create`
+
+```python
+table_create(req: TableCreateReq) → TableCreateRes
+```
+
+---
+
+
+
+### method `table_create_from_digests`
+
+```python
+table_create_from_digests(
+ req: TableCreateFromDigestsReq
+) → TableCreateFromDigestsRes
+```
+
+---
+
+
+
+### method `table_query`
+
+```python
+table_query(req: TableQueryReq) → TableQueryRes
+```
+
+---
+
+
+
+### method `table_query_stats`
+
+```python
+table_query_stats(req: TableQueryStatsReq) → TableQueryStatsRes
+```
+
+---
+
+
+
+### method `table_query_stats_batch`
+
+```python
+table_query_stats_batch(req: TableQueryStatsBatchReq) → TableQueryStatsBatchRes
+```
+
+---
+
+
+
+### method `table_query_stream`
+
+```python
+table_query_stream(req: TableQueryReq) → Iterator[TableRowSchema]
+```
+
+---
+
+
+
+### method `table_update`
+
+```python
+table_update(req: TableUpdateReq) → TableUpdateRes
+```
+
+---
+
+
+
+### method `threads_query_stream`
+
+```python
+threads_query_stream(req: ThreadsQueryReq) → Iterator[ThreadSchema]
+```
+
+---
+
+
+
+## class `ImageGenerationCreateReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `inputs`: ``
+- `wb_user_id`: `str | None`
+- `track_llm_call`: `bool | None`
+
+---
+
+
+
+## class `ImageGenerationCreateRes`
+
+**Pydantic Fields:**
+
+- `response`: `dict[str, typing.Any]`
+- `weave_call_id`: `str | None`
+
+---
+
+
+
+## class `ImageGenerationRequestInputs`
+
+**Pydantic Fields:**
+
+- `model`: ``
+- `prompt`: ``
+- `n`: `int | None`
+
+---
+
+
+
+## class `LLMCostSchema`
+
+---
+
+
+
+## class `LLMUsageSchema`
+
+---
+
+
+
+## class `ModelCreateBody`
+
+**Pydantic Fields:**
+
+- `name`: ``
+- `description`: `str | None`
+- `source_code`: ``
+- `attributes`: `dict[str, typing.Any] | None`
+
+---
+
+
+
+## class `ModelCreateReq`
+
+**Pydantic Fields:**
+
+- `name`: ``
+- `description`: `str | None`
+- `source_code`: ``
+- `attributes`: `dict[str, typing.Any] | None`
+- `project_id`: ``
+- `wb_user_id`: `str | None`
+
+---
+
+
+
+## class `ModelCreateRes`
+
+**Pydantic Fields:**
+
+- `digest`: ``
+- `object_id`: ``
+- `version_index`: ``
+- `model_ref`: ``
+
+---
+
+
+
+## class `ModelDeleteReq`
+
+**Pydantic Fields:**
+
+- `project_id`: ``
+- `object_id`: `