From bcefa56eedb1d0f2629708c326d10a6542f33be5 Mon Sep 17 00:00:00 2001
From: dbrian57 <17599248+dbrian57@users.noreply.github.com>
Date: Thu, 28 May 2026 15:24:45 +0000
Subject: [PATCH 1/5] chore: Update reference documentation (Weave 0.52.41)
---
weave/reference/python-sdk.mdx | 1287 ++++++++++++++---
weave/reference/python-sdk/trace/feedback.mdx | 34 +-
weave/reference/python-sdk/trace/op.mdx | 38 +-
weave/reference/python-sdk/trace/util.mdx | 22 +-
.../python-sdk/trace/weave_client.mdx | 128 +-
.../trace_server/trace_server_interface.mdx | 1281 ++++++++++------
.../remote_http_trace_server.mdx | 249 ++--
weave/reference/service-api.mdx | 81 +-
weave/reference/service-api/openapi.json | 52 +
weave/reference/typescript-sdk.mdx | 36 +
.../typescript-sdk/classes/dataset.mdx | 20 +-
.../typescript-sdk/classes/evaluation.mdx | 14 +-
.../classes/evaluationlogger.mdx | 8 +-
.../reference/typescript-sdk/classes/llm.mdx | 333 +++++
.../typescript-sdk/classes/messagesprompt.mdx | 16 +-
.../typescript-sdk/classes/objectref.mdx | 16 +-
.../typescript-sdk/classes/scorelogger.mdx | 8 +-
.../typescript-sdk/classes/session.mdx | 109 ++
.../typescript-sdk/classes/stringprompt.mdx | 16 +-
.../typescript-sdk/classes/subagent.mdx | 102 ++
.../reference/typescript-sdk/classes/tool.mdx | 130 ++
.../reference/typescript-sdk/classes/turn.mdx | 176 +++
.../typescript-sdk/classes/weaveclient.mdx | 136 +-
.../typescript-sdk/classes/weaveobject.mdx | 10 +-
.../createopenaiagentstracingprocessor.mdx | 2 +-
.../functions/createotelextension.mdx | 51 +
.../typescript-sdk/functions/endllm.mdx | 20 +
.../typescript-sdk/functions/endsession.mdx | 20 +
.../typescript-sdk/functions/endturn.mdx | 20 +
.../typescript-sdk/functions/flushotel.mdx | 29 +
.../functions/getcurrentllm.mdx | 20 +
.../functions/getcurrentsession.mdx | 20 +
.../functions/getcurrentturn.mdx | 20 +
.../typescript-sdk/functions/init.mdx | 4 +-
.../functions/instrumentopenaiagents.mdx | 4 +-
.../typescript-sdk/functions/login.mdx | 2 +-
.../reference/typescript-sdk/functions/op.mdx | 10 +-
.../functions/patchrealtimesession.mdx | 11 +-
.../requirecurrentcallstackentry.mdx | 2 +-
.../functions/requirecurrentchildsummary.mdx | 2 +-
.../typescript-sdk/functions/runisolated.mdx | 45 +
.../typescript-sdk/functions/startllm.mdx | 27 +
.../typescript-sdk/functions/startsession.mdx | 27 +
.../functions/startsubagent.mdx | 26 +
.../typescript-sdk/functions/starttool.mdx | 31 +
.../typescript-sdk/functions/startturn.mdx | 27 +
.../typescript-sdk/functions/weaveaudio.mdx | 2 +-
.../typescript-sdk/functions/weaveimage.mdx | 2 +-
.../functions/withattributes.mdx | 2 +-
.../functions/wrapgooglegenai.mdx | 2 +-
.../typescript-sdk/functions/wrapopenai.mdx | 2 +-
.../typescript-sdk/interfaces/callschema.mdx | 32 +-
.../typescript-sdk/interfaces/callsfilter.mdx | 18 +-
.../interfaces/getcallsoptions.mdx | 112 ++
.../typescript-sdk/interfaces/llminit.mdx | 35 +
.../typescript-sdk/interfaces/message.mdx | 68 +
.../typescript-sdk/interfaces/query.mdx | 28 +
.../typescript-sdk/interfaces/reasoning.mdx | 24 +
.../typescript-sdk/interfaces/sessioninit.mdx | 49 +
.../typescript-sdk/interfaces/sortby.mdx | 41 +
.../interfaces/subagentinit.mdx | 35 +
.../typescript-sdk/interfaces/toolinit.mdx | 46 +
.../typescript-sdk/interfaces/turninit.mdx | 35 +
.../typescript-sdk/interfaces/usage.mdx | 68 +
.../typescript-sdk/interfaces/weaveaudio.mdx | 6 +-
.../typescript-sdk/interfaces/weaveimage.mdx | 6 +-
.../type-aliases/messagepart.mdx | 14 +
.../typescript-sdk/type-aliases/modality.mdx | 14 +
.../typescript-sdk/type-aliases/op.mdx | 2 +-
.../type-aliases/opdecorator.mdx | 17 +-
.../typescript-sdk/type-aliases/role.mdx | 43 +
71 files changed, 4323 insertions(+), 1102 deletions(-)
create mode 100644 weave/reference/typescript-sdk/classes/llm.mdx
create mode 100644 weave/reference/typescript-sdk/classes/session.mdx
create mode 100644 weave/reference/typescript-sdk/classes/subagent.mdx
create mode 100644 weave/reference/typescript-sdk/classes/tool.mdx
create mode 100644 weave/reference/typescript-sdk/classes/turn.mdx
create mode 100644 weave/reference/typescript-sdk/functions/createotelextension.mdx
create mode 100644 weave/reference/typescript-sdk/functions/endllm.mdx
create mode 100644 weave/reference/typescript-sdk/functions/endsession.mdx
create mode 100644 weave/reference/typescript-sdk/functions/endturn.mdx
create mode 100644 weave/reference/typescript-sdk/functions/flushotel.mdx
create mode 100644 weave/reference/typescript-sdk/functions/getcurrentllm.mdx
create mode 100644 weave/reference/typescript-sdk/functions/getcurrentsession.mdx
create mode 100644 weave/reference/typescript-sdk/functions/getcurrentturn.mdx
create mode 100644 weave/reference/typescript-sdk/functions/runisolated.mdx
create mode 100644 weave/reference/typescript-sdk/functions/startllm.mdx
create mode 100644 weave/reference/typescript-sdk/functions/startsession.mdx
create mode 100644 weave/reference/typescript-sdk/functions/startsubagent.mdx
create mode 100644 weave/reference/typescript-sdk/functions/starttool.mdx
create mode 100644 weave/reference/typescript-sdk/functions/startturn.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/llminit.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/message.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/query.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/reasoning.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/sessioninit.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/sortby.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/subagentinit.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/toolinit.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/turninit.mdx
create mode 100644 weave/reference/typescript-sdk/interfaces/usage.mdx
create mode 100644 weave/reference/typescript-sdk/type-aliases/messagepart.mdx
create mode 100644 weave/reference/typescript-sdk/type-aliases/modality.mdx
create mode 100644 weave/reference/typescript-sdk/type-aliases/role.mdx
diff --git a/weave/reference/python-sdk.mdx b/weave/reference/python-sdk.mdx
index 88f740f5f5..3d1961a1f5 100644
--- a/weave/reference/python-sdk.mdx
+++ b/weave/reference/python-sdk.mdx
@@ -10,7 +10,7 @@ import { SourceLink } from '/snippets/_includes/source-link.mdx';
---
-
+
## class `Agent`
@@ -24,7 +24,7 @@ import { SourceLink } from '/snippets/_includes/source-link.mdx';
- `system_message`: ``
- `tools`: `list[typing.Any]`
-
+
### method `step`
@@ -44,7 +44,7 @@ Run a step of the agent.
---
-
+
## class `AgentState`
@@ -57,7 +57,7 @@ Run a step of the agent.
---
-
+
## class `AnnotationSpec`
@@ -69,7 +69,7 @@ Run a step of the agent.
- `unique_among_creators`: ``
- `op_scope`: `list[str] | None`
-
+
### classmethod `preprocess_field_schema`
@@ -79,7 +79,7 @@ preprocess_field_schema(data: dict[str, Any]) → dict[str, Any]
---
-
+
### classmethod `validate_field_schema`
@@ -89,7 +89,7 @@ validate_field_schema(schema: dict[str, Any]) → dict[str, Any]
---
-
+
### method `value_is_valid`
@@ -109,7 +109,7 @@ Validates a payload against this annotation spec's schema.
---
-
+
## class `Audio`
A class representing audio data in a supported format (wav or mp3).
@@ -131,7 +131,7 @@ This class handles audio data storage and provides methods for loading from diff
- `ValueError`: If audio data is empty or format is not supported
-
+
### method `__init__`
@@ -145,7 +145,7 @@ __init__(
---
-
+
### method `export`
@@ -160,7 +160,7 @@ Export audio data to a file.
---
-
+
### classmethod `from_data`
@@ -186,7 +186,7 @@ Create an Audio object from raw data and specified format.
---
-
+
### classmethod `from_path`
@@ -210,7 +210,93 @@ Create an Audio object from a file path.
---
-
+
+
+## class `ClassifierMonitor`
+A monitor that merges multiple scorers into a single classifier.
+
+Classifier monitors combine prompts from multiple LLMAsAJudgeScorers targeting the same model into a single scoring call.
+
+**Pydantic Fields:**
+
+- `name`: `str | None`
+- `description`: `str | None`
+- `ref`: `trace.refs.ObjectRef | None`
+- `sampling_rate`: ``
+- `scorers`: `list[flow.scorer.Scorer]`
+- `op_names`: `list[typing.Union[typing.Literal['genai.turn_ended'], str]]`
+- `query`: `trace_server.interface.query.Query | None`
+- `is_traced`: ``
+- `active`: ``
+- `scorer_debounce_config`: `flow.monitor.ScorerDebounceConfig | None`
+- `prompt_header`: `str | None`
+- `prompt_footer`: `str | None`
+
+
+
+### method `activate`
+
+```python
+activate() → ObjectRef
+```
+
+Activates the monitor.
+
+**Returns:**
+ The ref to the monitor.
+
+---
+
+
+
+### method `deactivate`
+
+```python
+deactivate() → ObjectRef
+```
+
+Deactivates the monitor.
+
+**Returns:**
+ The ref to the monitor.
+
+---
+
+
+
+### classmethod `from_obj`
+
+```python
+from_obj(obj: WeaveObject) → Self
+```
+
+---
+
+
+
+### method `get_prompt_footer`
+
+```python
+get_prompt_footer() → str
+```
+
+Text to append after the merged classifier prompts.
+
+---
+
+
+
+### method `get_prompt_header`
+
+```python
+get_prompt_header(op_name: str) → str
+```
+
+Text to prepend before the merged classifier prompts.
+
+---
+
+
## class `Content`
A class to represent content from various sources, resolving them to a unified byte-oriented representation with associated metadata.
@@ -223,7 +309,7 @@ This class must be instantiated using one of its classmethods:
- from_base64()
- from_data_url()
-
+
### method `__init__`
@@ -254,7 +340,7 @@ Direct initialization is disabled. Please use a classmethod like `Content.from_p
---
-
+
### method `as_string`
@@ -269,7 +355,7 @@ Display the data as a string. Bytes are decoded using the `encoding` attribute I
---
-
+
### classmethod `from_base64`
@@ -286,7 +372,7 @@ Initializes Content from a base64 encoded string or bytes.
---
-
+
### classmethod `from_bytes`
@@ -304,7 +390,7 @@ Initializes Content from raw bytes.
---
-
+
### classmethod `from_data_url`
@@ -316,7 +402,7 @@ Initializes Content from a data URL.
---
-
+
### classmethod `from_path`
@@ -333,7 +419,7 @@ Initializes Content from a local file path.
---
-
+
### classmethod `from_text`
@@ -351,7 +437,7 @@ Initializes Content from a string of text.
---
-
+
### classmethod `from_url`
@@ -370,7 +456,7 @@ Downloads the content, infers mimetype/extension from headers, URL path, and dat
---
-
+
### classmethod `model_validate`
@@ -390,7 +476,7 @@ Override model_validate to handle Content reconstruction from dict.
---
-
+
### classmethod `model_validate_json`
@@ -409,7 +495,7 @@ Override model_validate_json to handle Content reconstruction from JSON.
---
-
+
### method `open`
@@ -427,7 +513,7 @@ This method uses the platform-specific mechanism to open the file with the defau
---
-
+
### method `save`
@@ -442,7 +528,7 @@ Copy the file to the specified destination path. Updates the filename and the pa
---
-
+
### method `serialize_data`
@@ -454,7 +540,7 @@ When dumping model in json mode
---
-
+
### method `to_data_url`
@@ -474,7 +560,7 @@ Constructs a data URL from the content.
---
-
+
## class `Dataset`
Dataset object with easy saving and automatic versioning.
@@ -505,7 +591,7 @@ example_label = dataset_ref.rows[2]['sentence']
- `ref`: `trace.refs.ObjectRef | None`
- `rows`: `trace.table.Table | trace.vals.WeaveTable`
-
+
### method `add_rows`
@@ -526,7 +612,7 @@ This is useful for adding examples to large datasets without having to load the
---
-
+
### classmethod `convert_to_table`
@@ -536,7 +622,7 @@ convert_to_table(rows: Any) → Table | WeaveTable
---
-
+
### classmethod `from_calls`
@@ -546,19 +632,17 @@ from_calls(calls: Iterable[Call]) → Self
---
-
+
### classmethod `from_hf`
```python
-from_hf(
- hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')]
-) → Self
+from_hf(hf_dataset: 'HFDataset | HFDatasetDict') → Self
```
---
-
+
### classmethod `from_obj`
@@ -568,7 +652,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### classmethod `from_pandas`
@@ -578,7 +662,7 @@ from_pandas(df: 'DataFrame') → Self
---
-
+
### method `select`
@@ -597,7 +681,7 @@ Select rows from the dataset based on the provided indices.
---
-
+
### method `to_hf`
@@ -607,7 +691,7 @@ to_hf() → HFDataset
---
-
+
### method `to_pandas`
@@ -617,11 +701,11 @@ to_pandas() → DataFrame
---
-
+
## class `EasyPrompt`
-
+
### method `__init__`
@@ -677,7 +761,7 @@ Join all messages into a system prompt object.
---
-
+
### method `append`
@@ -687,7 +771,7 @@ append(item: Any, role: str | None = None, dedent: bool = False) → None
---
-
+
### method `as_dict`
@@ -697,7 +781,7 @@ as_dict() → dict[str, Any]
---
-
+
### method `as_pydantic_dict`
@@ -707,7 +791,7 @@ as_pydantic_dict() → dict[str, Any]
---
-
+
### method `bind`
@@ -717,7 +801,7 @@ bind(*args: Any, **kwargs: Any) → Prompt
---
-
+
### method `bind_rows`
@@ -727,7 +811,7 @@ bind_rows(dataset: list[dict] | Any) → list['Prompt']
---
-
+
### method `config_table`
@@ -737,7 +821,7 @@ config_table(title: str | None = None) → Table
---
-
+
### method `configure`
@@ -747,7 +831,7 @@ configure(config: dict | None = None, **kwargs: Any) → Prompt
---
-
+
### method `dump`
@@ -757,7 +841,7 @@ dump(fp: ) → None
---
-
+
### method `dump_file`
@@ -767,7 +851,7 @@ dump_file(filepath: str | Path) → None
---
-
+
### method `format`
@@ -777,7 +861,7 @@ format(**kwargs: Any) → Any
---
-
+
### classmethod `from_obj`
@@ -787,7 +871,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### classmethod `load`
@@ -797,7 +881,7 @@ load(fp: ) → Self
---
-
+
### classmethod `load_file`
@@ -807,7 +891,7 @@ load_file(filepath: str | Path) → Self
---
-
+
### method `messages_table`
@@ -817,7 +901,7 @@ messages_table(title: str | None = None) → Table
---
-
+
### method `print`
@@ -827,7 +911,7 @@ print() → str
---
-
+
### method `publish`
@@ -841,7 +925,7 @@ publish(
---
-
+
### method `require`
@@ -851,7 +935,7 @@ require(param_name: str, **kwargs: Any) → Prompt
---
-
+
### method `run`
@@ -861,7 +945,7 @@ run() → Any
---
-
+
### method `validate_requirement`
@@ -871,7 +955,7 @@ validate_requirement(key: str, value: Any) → list
---
-
+
### method `validate_requirements`
@@ -881,7 +965,7 @@ validate_requirements(values: dict[str, Any]) → list
---
-
+
### method `values_table`
@@ -891,7 +975,7 @@ values_table(title: str | None = None) → Table
---
-
+
## class `Evaluation`
Sets up an evaluation which includes a set of scorers and a dataset.
@@ -939,13 +1023,13 @@ asyncio.run(evaluation.evaluate(function_to_evaluate))
- `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`
+- `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`
@@ -955,7 +1039,7 @@ evaluate(model: Op | Model) → dict
---
-
+
### classmethod `from_obj`
@@ -965,7 +1049,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### method `get_eval_results`
@@ -975,7 +1059,7 @@ get_eval_results(model: Op | Model) → EvaluationResults
---
-
+
### method `get_evaluate_calls`
@@ -1006,7 +1090,7 @@ for call in calls:
---
-
+
### method `get_score_calls`
@@ -1034,7 +1118,7 @@ for trace_id, calls in score_calls.items():
---
-
+
### method `get_scores`
@@ -1076,17 +1160,17 @@ Expected output:
---
-
+
### method `model_post_init`
```python
-model_post_init(_Evaluation__context: Any) → None
+model_post_init(context: Any) → None
```
---
-
+
### method `predict_and_score`
@@ -1096,7 +1180,7 @@ predict_and_score(model: Op | Model, example: dict) → dict
---
-
+
### method `summarize`
@@ -1106,7 +1190,7 @@ summarize(eval_table: EvaluationResults) → dict
---
-
+
## class `EvaluationLogger`
This class provides an imperative interface for logging evaluations.
@@ -1145,7 +1229,7 @@ with ev.log_prediction(inputs={'q': 'Hello'}) as pred:
ev.log_summary({"avg_score": 0.9})
```
-
+
### method `__init__`
@@ -1169,7 +1253,7 @@ __init__(
---
-
+
### method `fail`
@@ -1181,7 +1265,7 @@ Convenience method to fail the evaluation with an exception.
---
-
+
### method `finish`
@@ -1195,7 +1279,7 @@ Ensures all prediction calls and the main evaluation call are finalized. This is
---
-
+
### method `log_example`
@@ -1229,7 +1313,7 @@ ev.log_example(
---
-
+
### method `log_prediction`
@@ -1257,7 +1341,7 @@ Example (context manager):
---
-
+
### method `log_summary`
@@ -1271,7 +1355,7 @@ This will calculate the summary, call the summarize op, and then finalize the ev
---
-
+
### method `set_view`
@@ -1309,12 +1393,12 @@ Saves the provided content as an object in the project and writes its reference
---
-
+
## class `File`
A class representing a file with path, mimetype, and size information.
-
+
### method `__init__`
@@ -1341,7 +1425,7 @@ Get the filename of the file.
---
-
+
### method `open`
@@ -1359,7 +1443,7 @@ This method uses the platform-specific mechanism to open the file with the defau
---
-
+
### method `save`
@@ -1374,12 +1458,160 @@ Copy the file to the specified destination path.
---
-
+
+
+## class `LLM`
+One LLM API call. Maps to a chat OTel span.
+
+ - `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:**
+
+- `model`: ``
+- `provider_name`: ``
+- `response_id`: ``
+- `response_model`: ``
+- `output_type`: ``
+- `system_instructions`: `list[str]`
+- `usage`: ``
+- `reasoning`: ``
+- `finish_reasons`: `list[str]`
+- `input_messages`: `list[session.types.Message]`
+- `output_messages`: `list[session.types.Message]`
+- `media_attachments`: `list[session.types.MediaAttachment]`
+- `request_temperature`: `float | None`
+- `request_max_tokens`: `int | None`
+- `request_top_p`: `float | None`
+- `request_frequency_penalty`: `float | None`
+- `request_presence_penalty`: `float | None`
+- `request_seed`: `int | None`
+- `request_stop_sequences`: `list[str]`
+- `request_choice_count`: `int | None`
+- `started_at`: `datetime.datetime | None`
+- `ended_at`: `datetime.datetime | None`
+
+
+
+### method `attach_media`
+
+```python
+attach_media(
+ content: 'bytes | str' = '',
+ uri: 'str' = '',
+ file_id: 'str' = '',
+ mime_type: 'str' = '',
+ modality: 'str' = ''
+) → LLM
+```
+
+Attach media to this LLM call.
+
+Exactly one of content, uri, or file_id must be provided. Modality is inferred from mime_type when not set explicitly.
+
+---
+
+
+
+### method `attach_media_url`
+
+```python
+attach_media_url(url: 'str', modality: 'str' = '') → LLM
+```
+
+Attach a media URL to this LLM call.
+
+Convenience over ``attach_media`` for the common case where the caller has a URL string from an upstream message and doesn't want to inspect it. ``data:`` URLs are parsed into ``mime_type`` + inline content (kind=blob); plain URIs become ``kind=uri``. Empty URLs are ignored. Returns ``self`` for chaining.
+
+---
+
+
+
+### method `end`
+
+```python
+end() → None
+```
+
+---
+
+
+
+### method `model_post_init`
+
+```python
+model_post_init(context: 'Any') → None
+```
+
+---
+
+
+
+### method `output`
+
+```python
+output(content: 'str') → LLM
+```
+
+Append an assistant message to output_messages.
+
+---
+
+
+
+### method `record`
+
+```python
+record(
+ input_messages: 'list[Message] | None' = None,
+ output_messages: 'list[Message] | None' = None,
+ media_attachments: 'list[MediaAttachment] | None' = None,
+ usage: 'Usage | None' = None,
+ reasoning: 'Reasoning | str | None' = None,
+ response_id: 'str | None' = None,
+ response_model: 'str | None' = None,
+ finish_reasons: 'list[str] | None' = None,
+ output_type: 'str | None' = None
+) → LLM
+```
+
+Set multiple LLM-call fields in one call.
+
+Manually-instrumented agents typically build up a chat span by assigning eight or more individual fields at the end of an LLM call (``input_messages``, ``output_messages``, ``usage``, ``response_id``, etc.). ``record(...)`` collapses those into a single keyword call so the recording site stays compact.
+
+Only fields explicitly passed (non-``None``) are applied — existing values are preserved. ``reasoning`` accepts either a ``Reasoning`` instance or a plain string (wrapped automatically). Returns ``self`` for chaining.
+
+---
+
+
+
+### method `think`
+
+```python
+think(content: 'str') → LLM
+```
+
+Set reasoning/chain-of-thought content.
+
+---
+
+
+
+## class `LogResult`
+Result of a batch log_* call.
+
+**Pydantic Fields:**
+
+- `session_id`: ``
+- `trace_ids`: `list[str]`
+- `root_span_ids`: `list[str]`
+- `span_count`: ``
+
+---
+
+
## 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.
@@ -1388,7 +1620,7 @@ A Markdown renderable.
- `style` (Union[str, Style], optional): Optional style to apply to markdown.
- `hyperlinks` (bool, optional): Enable hyperlinks. Defaults to ``True``.
-
+
### method `__init__`
@@ -1406,11 +1638,105 @@ __init__(
---
-
+
+
+## class `MediaAttachment`
+A media attachment on an LLM call.
+
+ - `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:**
+
+- `kind`: `typing.Literal['blob', 'uri', 'file']`
+- `modality`: ``
+- `mime_type`: ``
+- `content`: `bytes | str`
+- `uri`: ``
+- `file_id`: ``
+
+---
+
+
+
+## class `Message`
+A single message in a conversation.
+
+Two construction styles are supported:
+
+1. Flat (back-compat, ergonomic for plain text): ``Message(role="assistant", content="Hi there")``
+
+2. Explicit parts (richer — supports tool calls, mixed reasoning+text, inline media): ``Message(role="assistant", parts=[TextPart(content="Let me check"), ToolCallPart(id="c1", name="get_weather", arguments='{...}')])``
+
+When ``parts`` is non-empty it is the canonical representation. When empty, the serializer synthesizes a single TextPart (or ToolCallResponsePart for ``role="tool"``) from the flat fields.
+
+**Pydantic Fields:**
+
+- `role`: `typing.Literal['user', 'assistant', 'system', 'tool']`
+- `content`: ``
+- `tool_call_id`: ``
+- `tool_name`: ``
+- `parts`: `list[typing.Annotated[session.types.TextPart | session.types.ReasoningPart | session.types.ToolCallPart | session.types.ToolCallResponsePart | session.types.BlobPart | session.types.UriPart | session.types.FilePart, FieldInfo(annotation=NoneType, required=True, discriminator='type')]]`
+
+
+
+### classmethod `assistant`
+
+```python
+assistant(
+ text: 'str' = '',
+ tool_calls: 'list[ToolCallPart] | None' = None
+) → Message
+```
+
+Build an assistant message with optional text and tool calls.
+
+Use plain text for simple replies; pass ``tool_calls`` when the assistant requests one or more tools. When both are present the text is emitted as a leading ``TextPart`` followed by each ``ToolCallPart`` so the chat view renders them inline.
+
+---
+
+
+
+### classmethod `system`
+
+```python
+system(text: 'str') → Message
+```
+
+Build a system message from plain text.
+
+---
+
+
+
+### classmethod `tool_result`
+
+```python
+tool_result(call_id: 'str', output: 'Any') → Message
+```
+
+Build a tool-result message for a previously-requested tool call.
+
+``output`` may be a string, dict, list, scalar, or ``None`` — the underlying ``ToolCallResponsePart`` JSON-encodes non-strings.
+
+---
+
+
+
+### classmethod `user`
+
+```python
+user(text: 'str') → Message
+```
+
+Build a user message from plain text.
+
+---
+
+
## class `MessagesPrompt`
-
+
### method `__init__`
@@ -1418,8 +1744,6 @@ __init__(
__init__(messages: list[dict])
```
- - `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`
@@ -1427,7 +1751,7 @@ __init__(messages: list[dict])
- `ref`: `trace.refs.ObjectRef | None`
- `messages`: `list[dict]`
-
+
### method `format`
@@ -1437,7 +1761,7 @@ format(**kwargs: Any) → list
---
-
+
### method `format_message`
@@ -1451,7 +1775,7 @@ This method delegates to the standalone format_message_with_template_vars functi
---
-
+
### classmethod `from_obj`
@@ -1461,7 +1785,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
## 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.
@@ -1487,7 +1811,7 @@ class YourModel(Model):
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
-
+
### method `get_infer_method`
@@ -1497,7 +1821,7 @@ get_infer_method() → Callable
---
-
+
## class `Monitor`
Sets up a monitor to score incoming calls automatically.
@@ -1540,13 +1864,13 @@ my_monitor.activate()
- `ref`: `trace.refs.ObjectRef | None`
- `sampling_rate`: ``
- `scorers`: `list[flow.scorer.Scorer]`
-- `op_names`: `list[str]`
+- `op_names`: `list[typing.Union[typing.Literal['genai.turn_ended'], str]]`
- `query`: `trace_server.interface.query.Query | None`
- `is_traced`: ``
- `active`: ``
- `scorer_debounce_config`: `flow.monitor.ScorerDebounceConfig | None`
-
+
### method `activate`
@@ -1561,7 +1885,7 @@ Activates the monitor.
---
-
+
### method `deactivate`
@@ -1576,7 +1900,7 @@ Deactivates the monitor.
---
-
+
### classmethod `from_obj`
@@ -1586,7 +1910,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
## class `Object`
Base class for Weave objects that can be tracked and versioned.
@@ -1595,9 +1919,9 @@ This class extends Pydantic's BaseModel to provide Weave-specific functionality
**Attributes:**
- - `name` (Optional[str]): A human-readable name for the object.
- - `description` (Optional[str]): A description of what the object represents.
- - `ref` (Optional[ObjectRef]): A reference to the object in the Weave system.
+ - `name` (str | None): A human-readable name for the object.
+ - `description` (str | None): A description of what the object represents.
+ - `ref` (ObjectRef | None): A reference to the object in the Weave system.
**Examples:**
```python
@@ -1614,7 +1938,7 @@ obj = Object.from_uri("weave:///entity/project/object:digest")
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
-
+
### classmethod `from_uri`
@@ -1644,7 +1968,7 @@ obj = MyObject.from_uri("weave:///entity/project/object:digest")
---
-
+
### classmethod `handle_relocatable_object`
@@ -1681,12 +2005,26 @@ This validator handles special cases where the input is an ObjectRef or WeaveObj
---
-
+
+
+### classmethod `strip_weave_serialization_metadata`
+
+```python
+strip_weave_serialization_metadata(data: Any) → Any
+```
+
+Strip weave serialization metadata from dict inputs.
+
+Weave's serialization adds _type, _class_name, and _bases to dicts for type reconstruction. These are not real model fields and must be removed before Pydantic validation, which uses extra="forbid".
+
+---
+
+
## class `ObjectRef`
ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ())
-
+
### method `__init__`
@@ -1710,7 +2048,11 @@ __init__(
---
-
+#### property is_digest_resolved
+
+---
+
+
### method `as_param_dict`
@@ -1720,7 +2062,7 @@ as_param_dict() → dict
---
-
+
### method `delete`
@@ -1730,7 +2072,7 @@ delete() → None
---
-
+
### method `get`
@@ -1740,7 +2082,7 @@ get(objectify: 'bool' = True) → Any
---
-
+
### method `is_descended_from`
@@ -1750,7 +2092,7 @@ is_descended_from(potential_ancestor: 'ObjectRef') → bool
---
-
+
### method `maybe_parse_uri`
@@ -1760,7 +2102,7 @@ maybe_parse_uri(s: 'str') → AnyRef | None
---
-
+
### method `parse_uri`
@@ -1770,7 +2112,7 @@ parse_uri(uri: 'str') → ObjectRef
---
-
+
### method `with_attr`
@@ -1780,7 +2122,7 @@ with_attr(attr: 'str') → Self
---
-
+
### method `with_extra`
@@ -1790,7 +2132,7 @@ with_extra(extra: 'tuple[str | Future[str], ]') → Self
---
-
+
### method `with_index`
@@ -1800,7 +2142,7 @@ with_index(index: 'int') → Self
---
-
+
### method `with_item`
@@ -1810,7 +2152,7 @@ with_item(item_digest: 'str | Future[str]') → Self
---
-
+
### method `with_key`
@@ -1820,7 +2162,7 @@ with_key(key: 'str') → Self
---
-
+
## class `Prompt`
@@ -1830,7 +2172,7 @@ with_key(key: 'str') → Self
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
-
+
### method `format`
@@ -1840,12 +2182,12 @@ format(**kwargs: Any) → Any
---
-
+
## class `SavedView`
A fluent-style class for working with SavedView objects.
-
+
### method `__init__`
@@ -1871,7 +2213,7 @@ __init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None
---
-
+
### method `add_column`
@@ -1881,7 +2223,7 @@ add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView
---
-
+
### method `add_columns`
@@ -1893,7 +2235,7 @@ Convenience method for adding multiple columns to the grid.
---
-
+
### method `add_filter`
@@ -1907,7 +2249,7 @@ add_filter(
---
-
+
### method `add_sort`
@@ -1917,7 +2259,7 @@ add_sort(field: 'str', direction: 'SortDirection') → SavedView
---
-
+
### method `column_index`
@@ -1927,7 +2269,7 @@ column_index(path: 'int | str | ObjectPath') → int
---
-
+
### method `filter_op`
@@ -1937,7 +2279,7 @@ filter_op(op_name: 'str | None') → SavedView
---
-
+
### method `get_calls`
@@ -1955,7 +2297,7 @@ Get calls matching this saved view's filters and settings.
---
-
+
### method `get_known_columns`
@@ -1967,7 +2309,7 @@ Get the set of columns that are known to exist.
---
-
+
### method `get_table_columns`
@@ -1977,7 +2319,7 @@ get_table_columns() → list[TableColumn]
---
-
+
### method `hide_column`
@@ -1987,7 +2329,7 @@ hide_column(col_name: 'str') → SavedView
---
-
+
### method `insert_column`
@@ -2001,7 +2343,7 @@ insert_column(
---
-
+
### classmethod `load`
@@ -2011,7 +2353,7 @@ load(ref: 'str') → Self
---
-
+
### method `page_size`
@@ -2021,7 +2363,7 @@ page_size(page_size: 'int') → SavedView
---
-
+
### method `pin_column_left`
@@ -2031,7 +2373,7 @@ pin_column_left(col_name: 'str') → SavedView
---
-
+
### method `pin_column_right`
@@ -2041,7 +2383,7 @@ pin_column_right(col_name: 'str') → SavedView
---
-
+
### method `remove_column`
@@ -2051,7 +2393,7 @@ remove_column(path: 'int | str | ObjectPath') → SavedView
---
-
+
### method `remove_columns`
@@ -2063,7 +2405,7 @@ Remove columns from the saved view.
---
-
+
### method `remove_filter`
@@ -2073,7 +2415,7 @@ remove_filter(index_or_field: 'int | str') → SavedView
---
-
+
### method `remove_filters`
@@ -2085,7 +2427,7 @@ Remove all filters from the saved view.
---
-
+
### method `rename`
@@ -2095,7 +2437,7 @@ rename(label: 'str') → SavedView
---
-
+
### method `rename_column`
@@ -2105,7 +2447,7 @@ rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView
---
-
+
### method `save`
@@ -2117,7 +2459,7 @@ Publish the saved view to the server.
---
-
+
### method `set_columns`
@@ -2129,7 +2471,7 @@ Set the columns to be displayed in the grid.
---
-
+
### method `show_column`
@@ -2139,7 +2481,7 @@ show_column(col_name: 'str') → SavedView
---
-
+
### method `sort_by`
@@ -2149,7 +2491,7 @@ sort_by(field: 'str', direction: 'SortDirection') → SavedView
---
-
+
### method `to_grid`
@@ -2159,7 +2501,7 @@ to_grid(limit: 'int | None' = None) → Grid
---
-
+
### method `to_rich_table_str`
@@ -2169,7 +2511,7 @@ to_rich_table_str() → str
---
-
+
### method `ui_url`
@@ -2183,7 +2525,7 @@ Note this is the "result" page with traces etc, not the URL for the view object.
---
-
+
### method `unpin_column`
@@ -2193,7 +2535,7 @@ unpin_column(col_name: 'str') → SavedView
---
-
+
## class `Scorer`
@@ -2208,7 +2550,7 @@ unpin_column(col_name: 'str') → SavedView
#### property display_name
-
+
### classmethod `from_obj`
@@ -2218,17 +2560,17 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### method `model_post_init`
```python
-model_post_init(_Scorer__context: Any) → None
+model_post_init(context: Any) → None
```
---
-
+
### method `score`
@@ -2238,7 +2580,7 @@ score(output: Any, **kwargs: Any) → Any
---
-
+
### method `summarize`
@@ -2248,11 +2590,65 @@ summarize(score_rows: list) → dict | None
---
-
+
+
+## class `Session`
+A conversation session. Groups turns by conversation_id (no span).
+
+``continue_parent_trace`` controls trace isolation for the turns this session creates. Default ``False`` means each turn starts its own OTel trace (the right choice for the standalone Agents tab view). Set ``True`` when the application has an outer trace (e.g. a fastapi-instrumented request) that should contain the agent invocation.
+
+**Pydantic Fields:**
+
+- `session_id`: ``
+- `session_name`: ``
+- `agent_name`: ``
+- `model`: ``
+- `include_content`: ``
+- `continue_parent_trace`: ``
+
+
+
+### method `end`
+
+```python
+end() → None
+```
+
+---
+
+
+
+### method `model_post_init`
+
+```python
+model_post_init(context: 'Any') → None
+```
+
+---
+
+
+
+### method `start_turn`
+
+```python
+start_turn(
+ user_message: 'str' = '',
+ model: 'str' = '',
+ agent_name: 'str' = ''
+) → Turn
+```
+
+Create a new turn. Auto-ends the previous turn if still open.
+
+Sets the ``_current_turn`` contextvar so the turn is visible via ``get_current_turn()`` regardless of whether a context manager is used. Propagates ``continue_parent_trace`` from this session.
+
+---
+
+
## class `StringPrompt`
-
+
### method `__init__`
@@ -2267,7 +2663,7 @@ __init__(content: str)
- `ref`: `trace.refs.ObjectRef | None`
- `content`: ``
-
+
### method `format`
@@ -2277,7 +2673,7 @@ format(**kwargs: Any) → str
---
-
+
### classmethod `from_obj`
@@ -2287,11 +2683,68 @@ from_obj(obj: WeaveObject) → Self
---
-
+
+
+## class `SubAgent`
+A delegated agent invocation within a turn.
+
+Maps to a nested invoke_agent OTel span in the same trace.
+
+**Pydantic Fields:**
+
+- `name`: ``
+- `model`: ``
+- `agent_id`: ``
+- `agent_description`: ``
+- `agent_version`: ``
+- `started_at`: `datetime.datetime | None`
+- `ended_at`: `datetime.datetime | None`
+
+
+
+### method `end`
+
+```python
+end() → None
+```
+
+---
+
+
+
+### method `llm`
+
+```python
+llm(
+ model: 'str' = '',
+ provider_name: 'str' = '',
+ system_instructions: 'list[str] | None' = None
+) → LLM
+```
+
+Start an LLM call within this sub-agent.
+
+Sets the ``_current_llm`` contextvar so the LLM is visible via ``get_current_llm()`` regardless of whether a context manager is used.
+
+---
+
+
+
+### method `tool`
+
+```python
+tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
+```
+
+Start a tool execution within this sub-agent.
+
+---
+
+
## class `Table`
-
+
### method `__init__`
@@ -2305,7 +2758,7 @@ __init__(rows: 'list[dict]') → None
---
-
+
### method `append`
@@ -2317,7 +2770,7 @@ Add a row to the table.
---
-
+
### method `pop`
@@ -2329,7 +2782,7 @@ Remove a row at the given index from the table.
---
-
+
## class `ContextAwareThread`
A Thread that runs functions with the context of the caller.
@@ -2349,7 +2802,7 @@ thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs))
thread.start()
```
-
+
### method `__init__`
@@ -2393,7 +2846,7 @@ This is a non-negative integer. See the get_native_id() function. This represent
---
-
+
### method `run`
@@ -2403,12 +2856,12 @@ run() → None
---
-
+
## class `ThreadContext`
Context object providing access to current thread and turn information.
-
+
### method `__init__`
@@ -2442,7 +2895,7 @@ Get the current turn_id from the active context.
---
-
+
## class `ContextAwareThreadPoolExecutor`
A ThreadPoolExecutor that runs functions with the context of the caller.
@@ -2461,7 +2914,7 @@ with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(_wrapped_fn, vals)
```
-
+
### method `__init__`
@@ -2471,7 +2924,7 @@ __init__(*args: 'Any', **kwargs: 'Any') → None
---
-
+
### method `map`
@@ -2486,7 +2939,7 @@ map(
---
-
+
### method `submit`
@@ -2496,7 +2949,146 @@ submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any
---
-
+
+
+## class `Tool`
+One tool execution. Maps to an execute_tool OTel span.
+
+``arguments`` and ``result`` use the ``JSONString`` annotation: callers can assign a dict / list / scalar and the SDK JSON-encodes it at construction or assignment. The stored value is always a string, matching the wire format per GenAI semconv.
+
+**Pydantic Fields:**
+
+- `name`: ``
+- `arguments`: ``
+- `result`: ``
+- `tool_call_id`: ``
+- `tool_type`: ``
+- `tool_description`: ``
+- `tool_definitions`: ``
+- `duration_ms`: ``
+- `started_at`: `datetime.datetime | None`
+- `ended_at`: `datetime.datetime | None`
+
+
+
+### method `end`
+
+```python
+end() → None
+```
+
+---
+
+
+
+## class `Turn`
+One user-agent exchange. Maps to an invoke_agent OTel span.
+
+By default each turn starts its own OTel trace (``continue_parent_trace=False``) so the Agents tab shows one trace per turn. Set ``continue_parent_trace=True`` on the Session (or directly on the Turn) when an outer trace is already active and you want the agent invocation to nest inside it — e.g. inside a fastapi-instrumented request.
+
+**Pydantic Fields:**
+
+- `agent_name`: ``
+- `model`: ``
+- `agent_id`: ``
+- `agent_description`: ``
+- `agent_version`: ``
+- `messages`: `list[session.types.Message]`
+- `spans`: `list[session.session.LLM | session.session.Tool | session.session.SubAgent]`
+- `continue_parent_trace`: ``
+- `started_at`: `datetime.datetime | None`
+- `ended_at`: `datetime.datetime | None`
+
+
+
+### method `end`
+
+```python
+end() → None
+```
+
+---
+
+
+
+### method `llm`
+
+```python
+llm(
+ model: 'str' = '',
+ provider_name: 'str' = '',
+ system_instructions: 'list[str] | None' = None
+) → LLM
+```
+
+Start an LLM call (chat span, child of this turn).
+
+Sets the ``_current_llm`` contextvar so the LLM is visible via ``get_current_llm()`` regardless of whether a context manager is used.
+
+---
+
+
+
+### method `model_post_init`
+
+```python
+model_post_init(context: 'Any') → None
+```
+
+---
+
+
+
+### method `subagent`
+
+```python
+subagent(name: 'str', model: 'str' = '') → SubAgent
+```
+
+Start a sub-agent invocation (nested invoke_agent span, same trace).
+
+---
+
+
+
+### method `tool`
+
+```python
+tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
+```
+
+Start a tool execution (execute_tool span, child of this turn).
+
+---
+
+
+
+### method `user`
+
+```python
+user(content: 'str') → Turn
+```
+
+Append a user message mid-turn.
+
+---
+
+
+
+## class `Usage`
+Token usage for an LLM call.
+
+**Pydantic Fields:**
+
+- `input_tokens`: ``
+- `output_tokens`: ``
+- `reasoning_tokens`: ``
+- `cache_creation_input_tokens`: ``
+- `cache_read_input_tokens`: ``
+
+---
+
+
### function `add_tags`
@@ -2511,7 +3103,7 @@ Add tags to an object version.
---
-
+
### function `as_op`
@@ -2534,7 +3126,7 @@ Given a @weave.op decorated function, return its Op.
---
-
+
### function `attributes`
@@ -2552,7 +3144,43 @@ with weave.attributes({'env': 'production'}):
---
-
+
+
+### function `end_llm`
+
+```python
+end_llm() → None
+```
+
+End the current LLM call (from contextvar).
+
+---
+
+
+
+### function `end_session`
+
+```python
+end_session() → None
+```
+
+End the current session (from contextvar).
+
+---
+
+
+
+### function `end_turn`
+
+```python
+end_turn() → None
+```
+
+End the current turn (from contextvar).
+
+---
+
+
### function `finish`
@@ -2566,7 +3194,7 @@ Following finish, calls of weave.op decorated functions will no longer be logged
---
-
+
### function `get`
@@ -2596,7 +3224,7 @@ dataset2 = weave.get(ref) # same as dataset!
---
-
+
### function `get_aliases`
@@ -2615,7 +3243,7 @@ Get aliases for an object version.
---
-
+
### function `get_client`
@@ -2625,7 +3253,7 @@ get_client() → WeaveClient | None
---
-
+
### function `get_current_call`
@@ -2644,7 +3272,43 @@ Get the Call object for the currently executing Op, within that Op.
---
-
+
+
+### function `get_current_llm`
+
+```python
+get_current_llm() → LLM | None
+```
+
+Return the active LLM call from contextvar, or None.
+
+---
+
+
+
+### function `get_current_session`
+
+```python
+get_current_session() → Session | None
+```
+
+Return the active session from contextvar, or None.
+
+---
+
+
+
+### function `get_current_turn`
+
+```python
+get_current_turn() → Turn | None
+```
+
+Return the active turn from contextvar, or None.
+
+---
+
+
### function `get_tags`
@@ -2663,7 +3327,7 @@ Get tags for an object version.
---
-
+
### function `get_tags_and_aliases`
@@ -2682,7 +3346,7 @@ Get both tags and aliases for an object version in a single call.
---
-
+
### function `init`
@@ -2691,6 +3355,9 @@ init(
project_name: 'str',
settings: 'UserSettings | dict[str, Any] | None' = None,
autopatch_settings: 'AutopatchSettings | None' = None,
+ postprocess_inputs: 'PostprocessInputsFunc | None' = None,
+ postprocess_output: 'PostprocessOutputFunc | None' = None,
+ attributes: 'dict[str, Any] | None' = None,
global_postprocess_inputs: 'PostprocessInputsFunc | None' = None,
global_postprocess_output: 'PostprocessOutputFunc | None' = None,
global_attributes: 'dict[str, Any] | None' = None
@@ -2706,20 +3373,52 @@ Following init, calls of weave.op decorated functions will be logged to the spec
**Args:**
-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
+NOTE: Client-level postprocessing runs after each op's own postprocessing. The order is always: 1. Op-specific postprocessing 2. Client-level postprocessing
- - `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.
+ - `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/platform/app/settings-page/user-settings#default-team) in the W&B Models documentation.
+ - `settings`: Configuration for the Weave client generally. Can be a UserSettings instance or a dict with any of the following keys (all optional). All settings can also be configured via environment variables using the prefix WEAVE_ (e.g., WEAVE_DISABLED=true). Available settings: - `disabled` (bool): Disables traces on all functions. Default: `False` - `print_call_link` (bool): Prints links in terminal to Weave UI for ops. Default: `True` - `log_level` (str): Sets what type of information to log (`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`). Default: `INFO` - `display_viewer` (str): Controls how Weave displays objects in the console (`auto`, `rich`, `print`). Default: `auto` - `capture_code` (bool): Captures code of traced ops to your Weave project. Default: `True` - `implicitly_patch_integrations` (bool): Auto-patches supported libraries. Default: `True` - `redact_pii` (bool): Scans all trace data for sensitive information, like emails, phone numbers, and credit cards, and replaces them with placeholder values before sending to the server. Requires presidio-analyzer and presidio-anonymizer packages.
+ - `Default`: `False` - `redact_pii_fields` (list[str]): Specifies which PII entity types to redact when `redact_pii` is True. If empty, uses Presidio's default set. Examples ['EMAIL','PHONE_NUMBER','CREDIT_CARD','US_SSN']. See full list at https://microsoft.github.io/presidio/supported_entities/
+ - `Default`: `[]` - `redact_pii_exclude_fields` (list[str]): PII entity types to exclude. Default: `[]` - `capture_client_info` (bool): Captures Python/SDK version info. Default: `True` - `capture_system_info` (bool): Captures OS information. Default: `True` - `client_parallelism` (int): Number of workers for background ops. Default: `auto` - `use_server_cache` (bool): Enables local disk caching of server responses. - `server_cache_size_limit` (int): Cache size limit in bytes. Default: `1_000_000_000` - `server_cache_dir` (str): Directory for server cache. Default: `temporary` - `scorers_dir` (str): Directory for scorer model checkpoints. Default: `~/.cache/wandb/weave-scorers` - `max_calls_queue_size` (int): Maximum queue size (0 = unbounded). Default: `100_000` - `retry_max_interval` (float): Maximum retry interval in seconds. Default: `300` - `retry_max_attempts` (int): Maximum number of retries. Default: `3` - `enable_disk_fallback` (bool): Writes dropped items to disk. Default: `True` - `use_parallel_table_upload` (bool): Enables parallel chunked upload for large tables. If False, tables are uploaded sequentially in smaller chunks.
+ - `Default`: `True` - `http_timeout` (float): Maximum time in seconds to wait for HTTP requests to complete. This includes connection time, data transfer, and server processing. Increase for slow networks or when working with large payloads.
+ - `Default`: `30.0` - `use_stainless_server` (bool): Uses the Stainless-generated HTTP client which provides better type safety, automatic retries, and improved error handling. This is experimental and may become the default in future versions.
+ - `Default`: `False` - `use_calls_complete` (bool): Uses an optimized write path that batches complete call data (start and end) into a single request instead of separate start/end requests. This reduces server load and improves performance, especially for short-lived ops.
+ - `Default`: `False`
- `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.
+ - `postprocess_inputs`: A function applied to the inputs of every op traced by this client.
+ - `postprocess_output`: A function applied to the output of every op traced by this client.
+ - `attributes`: A dictionary of attributes applied to every trace produced by this client.
**Returns:**
A Weave client.
---
-
+
+
+### function `link_prompt_to_registry`
+
+```python
+link_prompt_to_registry(
+ prompt: 'LinkablePrompt',
+ target_path: 'str',
+ aliases: 'Sequence[str] | None' = None
+) → LinkAssetToRegistryRes
+```
+
+Link a published prompt version into the registry.
+
+**Args:**
+
+
+ - `prompt`: A published prompt, an `ObjectRef`, or a fully qualified weave ///... URI string.
+ - `target_path`: Registry destination path in the format `/`, for example `wandb-registry-prompts/my-prompt-collection`.
+ - `aliases`: Optional aliases to attach to the created registry version.
+**Returns:**
+
+ - `LinkAssetToRegistryRes`: Parsed response from the registry-link endpoint.
+
+---
+
+
### function `list_aliases`
@@ -2734,7 +3433,7 @@ List all distinct aliases in the project.
---
-
+
### function `list_tags`
@@ -2749,7 +3448,7 @@ List all distinct tags in the project.
---
-
+
### function `log_call`
@@ -2836,7 +3535,54 @@ import weave
---
-
+
+
+### function `log_session`
+
+```python
+log_session(
+ turns: 'list[Turn]',
+ session_id: 'str' = '',
+ session_name: 'str' = '',
+ agent_name: 'str' = '',
+ model: 'str' = '',
+ include_content: 'bool' = True,
+ continue_parent_trace: 'bool' = False
+) → LogResult
+```
+
+Imperatively emit a complete session.
+
+Each Turn's ``.spans`` attribute provides its children. Auto-generates ``session_id`` if empty. By default each turn gets its own OTel trace.
+
+---
+
+
+
+### function `log_turn`
+
+```python
+log_turn(
+ session_id: 'str',
+ agent_name: 'str' = '',
+ session_name: 'str' = '',
+ model: 'str' = '',
+ messages: 'list[Message] | None' = None,
+ spans: 'list[LLM | Tool | SubAgent] | None' = None,
+ started_at: 'datetime | None' = None,
+ ended_at: 'datetime | None' = None,
+ include_content: 'bool' = True,
+ continue_parent_trace: 'bool' = False
+) → LogResult
+```
+
+Imperatively emit one turn and its child spans to OTel.
+
+Use when context managers aren't viable (stateless containers, callbacks, queue workers). Each child span passed in should have ``started_at`` / ``ended_at`` set; the emitted OTel span timestamps come from those fields. Falls back to the earliest/latest child timestamp, then ``now()``, when the turn doesn't supply its own.
+
+---
+
+
### function `op`
@@ -2863,22 +3609,17 @@ A decorator to weave op-ify a function or method. Works for both sync and async.
---
-
+
-### function `publish`
+### function `otel_traces_endpoint`
```python
-publish(
- obj: 'Any',
- name: 'str | None' = None,
- tags: 'list[str] | None' = None,
- aliases: 'list[str] | None' = None
-) → ObjectRef
+otel_traces_endpoint(base_url: str | None = None) → str
```
-Save and version a Python object.
+Return the full OTLP HTTP endpoint URL for Weave GenAI trace ingestion.
-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.
+External callers (e.g. boot-time probes that want to verify the ingest endpoint is reachable before relying on the BatchSpanProcessor to silently drop exports) should call this rather than constructing the URL by hand. The path is owned by the SDK and may move.
- `func`: The function to decorate.
- `name`: Custom name for the op. Defaults to the function name.
@@ -2892,6 +3633,29 @@ Weave creates a new version of the object if the object's name already exists an
**Args:**
+---
+
+
+
+### function `publish`
+
+```python
+publish(
+ obj: 'Any',
+ name: 'str | None' = None,
+ tags: 'list[str] | None' = None,
+ aliases: 'list[str] | None' = None
+) → ObjectRef
+```
+
+Save and version a Python object.
+
+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.
+
+ - `base_url`: Trace server base URL. Defaults to ``weave_trace_server_url()``.
+**Args:**
+
+
- `obj`: The object to save and version.
- `name`: The name to save the object under.
- `tags`: Optional list of tags to add to the published object version.
@@ -2901,7 +3665,7 @@ Weave creates a new version of the object if the object's name already exists an
---
-
+
### function `ref`
@@ -2920,7 +3684,7 @@ Creates a Ref to an existing Weave object. This does not directly retrieve the o
---
-
+
### function `remove_aliases`
@@ -2935,7 +3699,7 @@ Remove one or more aliases from an object.
---
-
+
### function `remove_tags`
@@ -2952,7 +3716,7 @@ Remove tags from an object version.
---
-
+
### function `require_current_call`
@@ -3003,7 +3767,7 @@ print(call.id)
---
-
+
### function `set_aliases`
@@ -3018,7 +3782,7 @@ Set one or more aliases for an object version.
---
-
+
### function `set_view`
@@ -3060,13 +3824,98 @@ Attach a custom view to the current call summary at `_weave.views.`.
---
-
+
+
+### function `start_llm`
+
+```python
+start_llm(
+ model: 'str' = '',
+ provider_name: 'str' = '',
+ system_instructions: 'list[str] | None' = None
+) → LLM
+```
+
+Create and activate an LLM call. Uses the current turn if available.
+
+If no turn is active, returns a disconnected LLM (no contextvar set).
+
+Pass ``provider_name`` explicitly. The SDK does not infer it from the model identifier: prefix-based guessing misattributes user fine-tunes (e.g. a model named ``text-...``) and bakes assumptions about future model names into telemetry that's expensive to correct after the fact.
+
+---
+
+
+
+### function `start_session`
+
+```python
+start_session(
+ agent_name: 'str' = '',
+ model: 'str' = '',
+ session_id: 'str' = '',
+ session_name: 'str' = '',
+ include_content: 'bool' = True,
+ continue_parent_trace: 'bool' = False
+) → Session
+```
+
+Create and activate a session. Sets the contextvar for cross-module access.
+
+---
+
+
+
+### function `start_subagent`
+
+```python
+start_subagent(name: 'str', model: 'str' = '') → SubAgent
+```
+
+Create a sub-agent invocation span.
+
+The SubAgent's OTel span automatically becomes a child of whatever span is current in OTel context — typically a Turn span if one is active. Mirrors ``start_tool`` in shape; OTel context handles parent-child propagation, no explicit delegation is needed.
+
+---
+
+
+
+### function `start_tool`
+
+```python
+start_tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
+```
+
+Create a tool execution span.
+
+The Tool's OTel span automatically becomes a child of whatever span is current in OTel context — typically a Turn span if one is active. No explicit turn delegation is needed: parent-child propagation happens via OTel context, not via the Session SDK contextvars.
+
+---
+
+
+
+### function `start_turn`
+
+```python
+start_turn(
+ user_message: 'str' = '',
+ model: 'str' = '',
+ agent_name: 'str' = ''
+) → Turn
+```
+
+Create and activate a turn. Uses the current session if available.
+
+If no session is active, returns a disconnected Turn that is NOT set in the contextvar. This means ``get_current_turn()`` will return None. Use ``session.start_turn()`` instead if you need contextvar-based cross-module access.
+
+---
+
+
### function `thread`
```python
thread(
- thread_id: 'str | None | object' =