From a52122276b03f70a696c5491c940b4e6eed1e098 Mon Sep 17 00:00:00 2001 From: drtangible Date: Wed, 27 May 2026 15:35:41 -0500 Subject: [PATCH] [WIP] Update TS SDK reference --- .../weave/generate_typescript_sdk_docs.py | 6 +- 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 +++ 63 files changed, 2094 insertions(+), 165 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/scripts/reference-generation/weave/generate_typescript_sdk_docs.py b/scripts/reference-generation/weave/generate_typescript_sdk_docs.py index 3951daa32e..5b9d346f1a 100755 --- a/scripts/reference-generation/weave/generate_typescript_sdk_docs.py +++ b/scripts/reference-generation/weave/generate_typescript_sdk_docs.py @@ -517,8 +517,10 @@ def main(): original_cwd = os.getcwd() # Download Weave source - weave_source = download_weave_source(weave_version) - + # weave_source = download_weave_source(weave_version) + # TODO: Remove. Just pointing to more recent branch than tag v0.52.41 + weave_source = download_weave_source("05-27-chore_weave_ts_update_openai_move_to_devdependencies") + try: # Set up TypeScript project sdk_path = setup_typescript_project(weave_source) diff --git a/weave/reference/typescript-sdk.mdx b/weave/reference/typescript-sdk.mdx index 999c0bb894..9fea0b12fa 100644 --- a/weave/reference/typescript-sdk.mdx +++ b/weave/reference/typescript-sdk.mdx @@ -14,10 +14,15 @@ weave - [Dataset](./typescript-sdk/classes/dataset) - [Evaluation](./typescript-sdk/classes/evaluation) - [EvaluationLogger](./typescript-sdk/classes/evaluationlogger) +- [LLM](./typescript-sdk/classes/llm) - [MessagesPrompt](./typescript-sdk/classes/messagesprompt) - [ObjectRef](./typescript-sdk/classes/objectref) - [ScoreLogger](./typescript-sdk/classes/scorelogger) +- [Session](./typescript-sdk/classes/session) - [StringPrompt](./typescript-sdk/classes/stringprompt) +- [SubAgent](./typescript-sdk/classes/subagent) +- [Tool](./typescript-sdk/classes/tool) +- [Turn](./typescript-sdk/classes/turn) - [WeaveClient](./typescript-sdk/classes/weaveclient) - [WeaveObject](./typescript-sdk/classes/weaveobject) @@ -25,18 +30,40 @@ weave - [CallSchema](./typescript-sdk/interfaces/callschema) - [CallsFilter](./typescript-sdk/interfaces/callsfilter) +- [GetCallsOptions](./typescript-sdk/interfaces/getcallsoptions) +- [LLMInit](./typescript-sdk/interfaces/llminit) +- [Message](./typescript-sdk/interfaces/message) +- [Query](./typescript-sdk/interfaces/query) +- [Reasoning](./typescript-sdk/interfaces/reasoning) +- [SessionInit](./typescript-sdk/interfaces/sessioninit) +- [SortBy](./typescript-sdk/interfaces/sortby) +- [SubAgentInit](./typescript-sdk/interfaces/subagentinit) +- [ToolInit](./typescript-sdk/interfaces/toolinit) +- [TurnInit](./typescript-sdk/interfaces/turninit) +- [Usage](./typescript-sdk/interfaces/usage) - [WeaveAudio](./typescript-sdk/interfaces/weaveaudio) - [WeaveImage](./typescript-sdk/interfaces/weaveimage) ### Type Aliases +- [MessagePart](./typescript-sdk/type-aliases/messagepart) +- [Modality](./typescript-sdk/type-aliases/modality) - [OpDecorator](./typescript-sdk/type-aliases/opdecorator) - [Op](./typescript-sdk/type-aliases/op) +- [Role](./typescript-sdk/type-aliases/role) ### Functions - [createopenaiagentstracingprocessor](./typescript-sdk/functions/createopenaiagentstracingprocessor) +- [createotelextension](./typescript-sdk/functions/createotelextension) +- [endllm](./typescript-sdk/functions/endllm) +- [endsession](./typescript-sdk/functions/endsession) +- [endturn](./typescript-sdk/functions/endturn) +- [flushotel](./typescript-sdk/functions/flushotel) +- [getcurrentllm](./typescript-sdk/functions/getcurrentllm) +- [getcurrentsession](./typescript-sdk/functions/getcurrentsession) +- [getcurrentturn](./typescript-sdk/functions/getcurrentturn) - [init](./typescript-sdk/functions/init) - [instrumentopenaiagents](./typescript-sdk/functions/instrumentopenaiagents) - [login](./typescript-sdk/functions/login) @@ -44,6 +71,12 @@ weave - [patchrealtimesession](./typescript-sdk/functions/patchrealtimesession) - [requirecurrentcallstackentry](./typescript-sdk/functions/requirecurrentcallstackentry) - [requirecurrentchildsummary](./typescript-sdk/functions/requirecurrentchildsummary) +- [runisolated](./typescript-sdk/functions/runisolated) +- [startllm](./typescript-sdk/functions/startllm) +- [startsession](./typescript-sdk/functions/startsession) +- [startsubagent](./typescript-sdk/functions/startsubagent) +- [starttool](./typescript-sdk/functions/starttool) +- [startturn](./typescript-sdk/functions/startturn) - [weaveaudio](./typescript-sdk/functions/weaveaudio) - [weaveimage](./typescript-sdk/functions/weaveimage) - [withattributes](./typescript-sdk/functions/withattributes) @@ -53,3 +86,6 @@ weave ## Type Aliases + + + diff --git a/weave/reference/typescript-sdk/classes/dataset.mdx b/weave/reference/typescript-sdk/classes/dataset.mdx index fa297ae42d..cc12199db0 100644 --- a/weave/reference/typescript-sdk/classes/dataset.mdx +++ b/weave/reference/typescript-sdk/classes/dataset.mdx @@ -93,7 +93,7 @@ const ref = await dataset.save() #### Defined in -[dataset.ts:51](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/dataset.ts#L51) +[dataset.ts:51](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/dataset.ts#L51) ## Properties @@ -107,7 +107,7 @@ const ref = await dataset.save() #### Defined in -[weaveObject.ts:73](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L73) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L73) ___ @@ -117,7 +117,7 @@ ___ #### Defined in -[dataset.ts:49](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/dataset.ts#L49) +[dataset.ts:49](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/dataset.ts#L49) ## Accessors @@ -135,7 +135,7 @@ WeaveObject.description #### Defined in -[weaveObject.ts:100](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L100) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L100) ___ @@ -149,7 +149,7 @@ ___ #### Defined in -[dataset.ts:64](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/dataset.ts#L64) +[dataset.ts:64](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/dataset.ts#L64) ___ @@ -167,7 +167,7 @@ WeaveObject.name #### Defined in -[weaveObject.ts:96](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L96) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -181,7 +181,7 @@ WeaveObject.name #### Defined in -[dataset.ts:68](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/dataset.ts#L68) +[dataset.ts:68](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/dataset.ts#L68) ___ @@ -201,7 +201,7 @@ ___ #### Defined in -[dataset.ts:74](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/dataset.ts#L74) +[dataset.ts:74](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/dataset.ts#L74) ___ @@ -215,7 +215,7 @@ ___ #### Defined in -[dataset.ts:60](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/dataset.ts#L60) +[dataset.ts:60](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/dataset.ts#L60) ___ @@ -233,4 +233,4 @@ ___ #### Defined in -[weaveObject.ts:77](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/evaluation.mdx b/weave/reference/typescript-sdk/classes/evaluation.mdx index fc648413df..249b8d24ed 100644 --- a/weave/reference/typescript-sdk/classes/evaluation.mdx +++ b/weave/reference/typescript-sdk/classes/evaluation.mdx @@ -112,7 +112,7 @@ const results = await evaluation.evaluate({ model }); #### Defined in -[evaluation.ts:148](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluation.ts#L148) +[evaluation.ts:148](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluation.ts#L148) ## Properties @@ -126,7 +126,7 @@ const results = await evaluation.evaluate({ model }); #### Defined in -[weaveObject.ts:73](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L73) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L73) ## Accessors @@ -144,7 +144,7 @@ WeaveObject.description #### Defined in -[weaveObject.ts:100](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L100) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L100) ___ @@ -162,7 +162,7 @@ WeaveObject.name #### Defined in -[weaveObject.ts:96](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L96) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -185,7 +185,7 @@ WeaveObject.name #### Defined in -[evaluation.ts:163](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluation.ts#L163) +[evaluation.ts:163](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluation.ts#L163) ___ @@ -208,7 +208,7 @@ ___ #### Defined in -[evaluation.ts:231](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluation.ts#L231) +[evaluation.ts:231](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluation.ts#L231) ___ @@ -226,4 +226,4 @@ ___ #### Defined in -[weaveObject.ts:77](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx index 63e1b898d2..71418d8580 100644 --- a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx +++ b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx @@ -60,7 +60,7 @@ await ev.logSummary(); #### Defined in -[evaluationLogger.ts:554](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L554) +[evaluationLogger.ts:570](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L570) ## Methods @@ -98,7 +98,7 @@ await evalLogger.logSummary(); // Waits for everything #### Defined in -[evaluationLogger.ts:641](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L641) +[evaluationLogger.ts:657](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L657) ___ @@ -134,7 +134,7 @@ await scoreLogger.finish(); #### Defined in -[evaluationLogger.ts:666](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L666) +[evaluationLogger.ts:682](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L682) ___ @@ -160,4 +160,4 @@ it will wait for all pending operations to complete. #### Defined in -[evaluationLogger.ts:767](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L767) \ No newline at end of file +[evaluationLogger.ts:783](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L783) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/llm.mdx b/weave/reference/typescript-sdk/classes/llm.mdx new file mode 100644 index 0000000000..ac96618e1a --- /dev/null +++ b/weave/reference/typescript-sdk/classes/llm.mdx @@ -0,0 +1,333 @@ +--- +title: "Class: LLM" +description: "TypeScript SDK reference" +--- + +[weave](../) / LLM + + + +An LLM call. Emits a `chat` span with `gen_ai.*` attributes. + +Created by `weave.startLLM()` (or `turn.startLLM()`) and terminated with +`end()`. Only one LLM may be active in an async context at a time; nest +tool/subagent calls under it via `startTool` / `startSubagent`. + +Populate `inputMessages` / `outputMessages` / `usage` / `reasoning` directly, +or via the helper functions (`output`, `think`, `attachMedia`, `record`). + +All recorded data is flushed to the span at `end()`. + +`Example` + +```ts +const llm = weave.startLLM({model: 'gpt-4o-mini', providerName: 'openai'}); +try { + llm.inputMessages = [{role: 'user', content: prompt}]; + const resp = await openai.chat.completions.create({...}); + llm.output(resp.choices[0].message.content ?? ''); + llm.record({usage: {inputTokens: resp.usage?.prompt_tokens}}); +} finally { + llm.end(); +} +``` + +## Table of contents + +### Properties + +- [inputMessages](./llm#inputmessages) +- [model](./llm#model) +- [outputMessages](./llm#outputmessages) +- [providerName](./llm#providername) +- [reasoning](./llm#reasoning) +- [usage](./llm#usage) + +### Methods + +- [attachMedia](./llm#attachmedia) +- [attachMediaUrl](./llm#attachmediaurl) +- [end](./llm#end) +- [output](./llm#output) +- [record](./llm#record) +- [startSubagent](./llm#startsubagent) +- [startTool](./llm#starttool) +- [think](./llm#think) +- [create](./llm#create) + +## Properties + +### inputMessages + +• **inputMessages**: [`Message`](../interfaces/message)[] = `[]` + +Input messages sent to the model. Flushed to `gen_ai.input.messages` on +`end()`. + +#### Defined in + +[genai/llm.ts:78](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L78) + +___ + +### model + +• `Readonly` **model**: `string` + +#### Defined in + +[genai/llm.ts:98](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L98) + +___ + +### outputMessages + +• **outputMessages**: [`Message`](../interfaces/message)[] = `[]` + +Assistant messages returned by the model. Flushed to +`gen_ai.output.messages` on `end()`. + +#### Defined in + +[genai/llm.ts:83](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L83) + +___ + +### providerName + +• `Readonly` **providerName**: `string` + +#### Defined in + +[genai/llm.ts:99](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L99) + +___ + +### reasoning + +• `Optional` **reasoning**: [`Reasoning`](../interfaces/reasoning) + +Chain-of-thought content. Folded into the last assistant message as a +ReasoningPart at serialization time. + +#### Defined in + +[genai/llm.ts:90](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L90) + +___ + +### usage + +• **usage**: [`Usage`](../interfaces/usage) = `{}` + +Token counts and cache stats. Flushed to `gen_ai.usage.*` on `end()`. + +#### Defined in + +[genai/llm.ts:85](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L85) + +## Methods + +### attachMedia + +▸ **attachMedia**(`opts`): `this` + +Attach a media part to the last input message. Pick exactly one of + `content` (inline base64 bytes), `uri` (URI reference), or `fileId` + (pre-uploaded file id). + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | `AttachMediaOpts` | + +#### Returns + +`this` + +#### Defined in + +[genai/llm.ts:168](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L168) + +___ + +### attachMediaUrl + +▸ **attachMediaUrl**(`url`, `opts`): `this` + +Convenience for `attachMedia({uri, modality})`. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `url` | `string` | +| `opts` | `Object` | +| `opts.modality` | [`Modality`](../#modality) | + +#### Returns + +`this` + +#### Defined in + +[genai/llm.ts:186](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L186) + +___ + +### end + +▸ **end**(`opts?`): `void` + +Flush accumulated state to the span and close it. Idempotent. Pass +`error` to mark the span as failed. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts?` | `Object` | +| `opts.error?` | `Error` | + +#### Returns + +`void` + +#### Defined in + +[genai/llm.ts:246](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L246) + +___ + +### output + +▸ **output**(`content`): `this` + +Append an assistant message to the response. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `content` | `string` | + +#### Returns + +`this` + +#### Defined in + +[genai/llm.ts:141](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L141) + +___ + +### record + +▸ **record**(`opts`): `this` + +Bulk-set any subset of the mutable fields. Replaces (does not merge). +Useful for assigning everything at once after a provider call returns. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | `LLMRecordOpts` | + +#### Returns + +`this` + +#### Defined in + +[genai/llm.ts:197](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L197) + +___ + +### startSubagent + +▸ **startSubagent**(`opts`): [`SubAgent`](./subagent) + +Start a child SubAgent span nested under this LLM. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`SubAgentInit`](../interfaces/subagentinit) | + +#### Returns + +[`SubAgent`](./subagent) + +#### Defined in + +[genai/llm.ts:230](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L230) + +___ + +### startTool + +▸ **startTool**(`opts`): [`Tool`](./tool) + +Start a child Tool span nested under this LLM. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`ToolInit`](../interfaces/toolinit) | + +#### Returns + +[`Tool`](./tool) + +#### Defined in + +[genai/llm.ts:221](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L221) + +___ + +### think + +▸ **think**(`content`): `this` + +Set or extend the model's reasoning/chain-of-thought content. Accumulates + into `this.reasoning.content`. Folded into the last assistant message as + a `ReasoningPart` at serialization time, matching the Python SDK's + on-the-wire shape. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `content` | `string` | + +#### Returns + +`this` + +#### Defined in + +[genai/llm.ts:153](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L153) + +___ + +### create + +▸ **create**(`opts`): [`LLM`](./llm) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`LLMInit`](../interfaces/llminit) & `ChildSpanContext` | + +#### Returns + +[`LLM`](./llm) + +#### Defined in + +[genai/llm.ts:102](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L102) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/messagesprompt.mdx b/weave/reference/typescript-sdk/classes/messagesprompt.mdx index 5a71477b77..ae3fb91418 100644 --- a/weave/reference/typescript-sdk/classes/messagesprompt.mdx +++ b/weave/reference/typescript-sdk/classes/messagesprompt.mdx @@ -57,7 +57,7 @@ Prompt.constructor #### Defined in -[prompt.ts:40](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L40) +[prompt.ts:40](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L40) ## Properties @@ -71,7 +71,7 @@ Prompt.\_\_savedRef #### Defined in -[weaveObject.ts:73](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L73) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L73) ___ @@ -81,7 +81,7 @@ ___ #### Defined in -[prompt.ts:38](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L38) +[prompt.ts:38](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L38) ## Accessors @@ -99,7 +99,7 @@ Prompt.description #### Defined in -[weaveObject.ts:100](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L100) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L100) ___ @@ -117,7 +117,7 @@ Prompt.name #### Defined in -[weaveObject.ts:96](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L96) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -137,7 +137,7 @@ Prompt.name #### Defined in -[prompt.ts:67](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L67) +[prompt.ts:67](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L67) ___ @@ -155,7 +155,7 @@ Prompt.saveAttrs #### Defined in -[weaveObject.ts:77](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L77) +[weaveObject.ts:77](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L77) ___ @@ -176,4 +176,4 @@ ___ #### Defined in -[prompt.ts:73](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L73) \ No newline at end of file +[prompt.ts:73](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L73) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/objectref.mdx b/weave/reference/typescript-sdk/classes/objectref.mdx index 27c3e5e8e0..f80bdec086 100644 --- a/weave/reference/typescript-sdk/classes/objectref.mdx +++ b/weave/reference/typescript-sdk/classes/objectref.mdx @@ -60,7 +60,7 @@ const uri = ref.uri(); // weave:///my-project/object/abc123:def456 #### Defined in -[weaveObject.ts:26](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L26) +[weaveObject.ts:26](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L26) ## Properties @@ -70,7 +70,7 @@ const uri = ref.uri(); // weave:///my-project/object/abc123:def456 #### Defined in -[weaveObject.ts:29](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L29) +[weaveObject.ts:29](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L29) ___ @@ -80,7 +80,7 @@ ___ #### Defined in -[weaveObject.ts:28](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L28) +[weaveObject.ts:28](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L28) ___ @@ -90,7 +90,7 @@ ___ #### Defined in -[weaveObject.ts:27](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L27) +[weaveObject.ts:27](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L27) ## Methods @@ -104,7 +104,7 @@ ___ #### Defined in -[weaveObject.ts:66](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L66) +[weaveObject.ts:66](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L66) ___ @@ -118,7 +118,7 @@ ___ #### Defined in -[weaveObject.ts:61](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L61) +[weaveObject.ts:61](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L61) ___ @@ -132,7 +132,7 @@ ___ #### Defined in -[weaveObject.ts:57](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L57) +[weaveObject.ts:57](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L57) ___ @@ -166,4 +166,4 @@ const ref = ObjectRef.fromUri('weave:///my-entity/my-project/object/my-dataset:a #### Defined in -[weaveObject.ts:44](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L44) \ No newline at end of file +[weaveObject.ts:44](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L44) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/scorelogger.mdx b/weave/reference/typescript-sdk/classes/scorelogger.mdx index f25b623b66..10116b6829 100644 --- a/weave/reference/typescript-sdk/classes/scorelogger.mdx +++ b/weave/reference/typescript-sdk/classes/scorelogger.mdx @@ -52,7 +52,7 @@ await pred.finish(); // Finalizes the prediction #### Defined in -[evaluationLogger.ts:319](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L319) +[evaluationLogger.ts:335](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L335) ## Accessors @@ -69,7 +69,7 @@ Used by EvaluationLogger to detect unfinished predictions. #### Defined in -[evaluationLogger.ts:349](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L349) +[evaluationLogger.ts:365](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L365) ## Methods @@ -87,7 +87,7 @@ Updates incremental aggregates and frees memory. #### Defined in -[evaluationLogger.ts:451](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L451) +[evaluationLogger.ts:467](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L467) ___ @@ -111,4 +111,4 @@ Creates a scorer call as a child of predict_and_score. #### Defined in -[evaluationLogger.ts:360](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/evaluationLogger.ts#L360) \ No newline at end of file +[evaluationLogger.ts:376](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/evaluationLogger.ts#L376) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/session.mdx b/weave/reference/typescript-sdk/classes/session.mdx new file mode 100644 index 0000000000..26508ef1ec --- /dev/null +++ b/weave/reference/typescript-sdk/classes/session.mdx @@ -0,0 +1,109 @@ +--- +title: "Class: Session" +description: "TypeScript SDK reference" +--- + +[weave](../) / Session + + + +A Session groups Turns under a single `gen_ai.conversation.id`. It is not +itself an OTel span — children stamp the conversation id onto theirs. + +## Table of contents + +### Properties + +- [agentName](./session#agentname) +- [model](./session#model) +- [sessionId](./session#sessionid) + +### Methods + +- [end](./session#end) +- [startTurn](./session#startturn) +- [create](./session#create) + +## Properties + +### agentName + +• `Readonly` **agentName**: `string` + +#### Defined in + +[genai/session.ts:22](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L22) + +___ + +### model + +• `Readonly` **model**: `string` + +#### Defined in + +[genai/session.ts:23](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L23) + +___ + +### sessionId + +• `Readonly` **sessionId**: `string` + +#### Defined in + +[genai/session.ts:24](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L24) + +## Methods + +### end + +▸ **end**(): `void` + +#### Returns + +`void` + +#### Defined in + +[genai/session.ts:51](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L51) + +___ + +### startTurn + +▸ **startTurn**(`opts?`): [`Turn`](./turn) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`TurnInit`](../interfaces/turninit) | + +#### Returns + +[`Turn`](./turn) + +#### Defined in + +[genai/session.ts:43](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L43) + +___ + +### create + +▸ **create**(`opts?`): [`Session`](./session) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`SessionInit`](../interfaces/sessioninit) | + +#### Returns + +[`Session`](./session) + +#### Defined in + +[genai/session.ts:27](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L27) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/stringprompt.mdx b/weave/reference/typescript-sdk/classes/stringprompt.mdx index 08ab9515f2..f78e8c3d30 100644 --- a/weave/reference/typescript-sdk/classes/stringprompt.mdx +++ b/weave/reference/typescript-sdk/classes/stringprompt.mdx @@ -57,7 +57,7 @@ Prompt.constructor #### Defined in -[prompt.ts:17](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L17) +[prompt.ts:17](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L17) ## Properties @@ -71,7 +71,7 @@ Prompt.\_\_savedRef #### Defined in -[weaveObject.ts:73](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L73) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L73) ___ @@ -81,7 +81,7 @@ ___ #### Defined in -[prompt.ts:15](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L15) +[prompt.ts:15](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L15) ## Accessors @@ -99,7 +99,7 @@ Prompt.description #### Defined in -[weaveObject.ts:100](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L100) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L100) ___ @@ -117,7 +117,7 @@ Prompt.name #### Defined in -[weaveObject.ts:96](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L96) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -137,7 +137,7 @@ Prompt.name #### Defined in -[prompt.ts:22](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L22) +[prompt.ts:22](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L22) ___ @@ -155,7 +155,7 @@ Prompt.saveAttrs #### Defined in -[weaveObject.ts:77](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L77) +[weaveObject.ts:77](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L77) ___ @@ -176,4 +176,4 @@ ___ #### Defined in -[prompt.ts:26](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/prompt.ts#L26) \ No newline at end of file +[prompt.ts:26](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/prompt.ts#L26) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/subagent.mdx b/weave/reference/typescript-sdk/classes/subagent.mdx new file mode 100644 index 0000000000..f6bc7beca5 --- /dev/null +++ b/weave/reference/typescript-sdk/classes/subagent.mdx @@ -0,0 +1,102 @@ +--- +title: "Class: SubAgent" +description: "TypeScript SDK reference" +--- + +[weave](../) / SubAgent + + + +A nested agent invocation — used when the current agent hands work to +another named agent (e.g. a planner calling a researcher). Emits an +`invoke_agent` span tagged with the sub-agent's name and (optionally) +its model. + +Created by `weave.startSubagent()` (or `turn.startAgent()`, or +`llm.startAgent()`) and terminated with `end()`. + +`Example` + +```ts +const sub = weave.startSubagent({name: 'researcher', model: 'gpt-4o'}); +try { + // ... orchestrate the sub-agent's LLM/Tool calls ... +} finally { + sub.end(); +} +``` + +## Table of contents + +### Properties + +- [model](./subagent#model) +- [name](./subagent#name) + +### Methods + +- [end](./subagent#end) +- [create](./subagent#create) + +## Properties + +### model + +• `Readonly` **model**: `string` + +#### Defined in + +[genai/subagent.ts:41](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/subagent.ts#L41) + +___ + +### name + +• `Readonly` **name**: `string` + +#### Defined in + +[genai/subagent.ts:40](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/subagent.ts#L40) + +## Methods + +### end + +▸ **end**(`opts?`): `void` + +Close the SubAgent span. Idempotent. Pass `error` to mark it as failed. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts?` | `Object` | +| `opts.error?` | `Error` | + +#### Returns + +`void` + +#### Defined in + +[genai/subagent.ts:65](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/subagent.ts#L65) + +___ + +### create + +▸ **create**(`opts`): [`SubAgent`](./subagent) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`SubAgentInit`](../interfaces/subagentinit) & `ChildSpanContext` | + +#### Returns + +[`SubAgent`](./subagent) + +#### Defined in + +[genai/subagent.ts:44](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/subagent.ts#L44) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/tool.mdx b/weave/reference/typescript-sdk/classes/tool.mdx new file mode 100644 index 0000000000..e05c698838 --- /dev/null +++ b/weave/reference/typescript-sdk/classes/tool.mdx @@ -0,0 +1,130 @@ +--- +title: "Class: Tool" +description: "TypeScript SDK reference" +--- + +[weave](../) / Tool + + + +A tool invocation. Emits an `execute_tool` span carrying the tool name, +the JSON-encoded arguments, the tool-call id, and the result. + +Created by `weave.startTool()` (or `turn.startTool()`, or +`llm.startTool()`) and terminated with `end()`. Assign `result` before +calling `end()` to record the tool's output on the span. + +`Example` + +```ts +const tool = weave.startTool({ + name: tc.function.name, + args: tc.function.arguments, + toolCallId: tc.id, +}); +try { + tool.result = await wikipediaSearch(JSON.parse(tc.function.arguments)); +} finally { + tool.end(); +} +``` + +## Table of contents + +### Properties + +- [args](./tool#args) +- [name](./tool#name) +- [result](./tool#result) +- [toolCallId](./tool#toolcallid) + +### Methods + +- [end](./tool#end) +- [create](./tool#create) + +## Properties + +### args + +• `Readonly` **args**: `string` + +#### Defined in + +[genai/tool.ts:52](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L52) + +___ + +### name + +• `Readonly` **name**: `string` + +#### Defined in + +[genai/tool.ts:51](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L51) + +___ + +### result + +• `Optional` **result**: `string` + +Tool output as a string. Recorded on `gen_ai.tool.call.result` at `end()`. + +#### Defined in + +[genai/tool.ts:45](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L45) + +___ + +### toolCallId + +• `Readonly` **toolCallId**: `string` + +#### Defined in + +[genai/tool.ts:53](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L53) + +## Methods + +### end + +▸ **end**(`opts?`): `void` + +Flush `result` to the span and close it. Idempotent. Pass `error` to +mark the span as failed. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts?` | `Object` | +| `opts.error?` | `Error` | + +#### Returns + +`void` + +#### Defined in + +[genai/tool.ts:83](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L83) + +___ + +### create + +▸ **create**(`opts`): [`Tool`](./tool) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`ToolInit`](../interfaces/toolinit) & `ChildSpanContext` | + +#### Returns + +[`Tool`](./tool) + +#### Defined in + +[genai/tool.ts:56](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L56) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/turn.mdx b/weave/reference/typescript-sdk/classes/turn.mdx new file mode 100644 index 0000000000..f2b8123bc3 --- /dev/null +++ b/weave/reference/typescript-sdk/classes/turn.mdx @@ -0,0 +1,176 @@ +--- +title: "Class: Turn" +description: "TypeScript SDK reference" +--- + +[weave](../) / Turn + + + +An agent invocation. Typically wraps the work to respond to a single +user message. Emits an `invoke_agent` span and acts as the root of the +trace for that turn: it is always started under `ROOT_CONTEXT` so it +never accidentally inherits a parent from another OTel-instrumented +library. + +Created by `weave.startTurn()` (or `session.startTurn()`) and +terminated with `end()`. Only one Turn may be active in an async chain. +Children (LLM, Tool, SubAgent) attach via the `startLLM`, `startTool`, +`startSubagent` methods. + +`Example` + +```ts +const turn = weave.startTurn({agentName: 'research-bot', model: MODEL}); +try { + const llm = turn.startLLM({model: MODEL, providerName: 'openai'}); + // ... + llm.end(); +} finally { + turn.end(); +} +``` + +## Table of contents + +### Properties + +- [agentName](./turn#agentname) +- [model](./turn#model) + +### Methods + +- [end](./turn#end) +- [startLLM](./turn#startllm) +- [startSubagent](./turn#startsubagent) +- [startTool](./turn#starttool) +- [create](./turn#create) + +## Properties + +### agentName + +• `Readonly` **agentName**: `string` + +#### Defined in + +[genai/turn.ts:57](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L57) + +___ + +### model + +• `Readonly` **model**: `string` + +#### Defined in + +[genai/turn.ts:58](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L58) + +## Methods + +### end + +▸ **end**(`opts?`): `void` + +Close the Turn span. Idempotent. Pass `error` to mark it as failed. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts?` | `Object` | +| `opts.error?` | `Error` | + +#### Returns + +`void` + +#### Defined in + +[genai/turn.ts:128](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L128) + +___ + +### startLLM + +▸ **startLLM**(`opts`): [`LLM`](./llm) + +Start a child LLM span under this Turn. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`LLMInit`](../interfaces/llminit) | + +#### Returns + +[`LLM`](./llm) + +#### Defined in + +[genai/turn.ts:101](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L101) + +___ + +### startSubagent + +▸ **startSubagent**(`opts`): [`SubAgent`](./subagent) + +Start a child SubAgent span under this Turn. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`SubAgentInit`](../interfaces/subagentinit) | + +#### Returns + +[`SubAgent`](./subagent) + +#### Defined in + +[genai/turn.ts:119](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L119) + +___ + +### startTool + +▸ **startTool**(`opts`): [`Tool`](./tool) + +Start a child Tool span under this Turn. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`ToolInit`](../interfaces/toolinit) | + +#### Returns + +[`Tool`](./tool) + +#### Defined in + +[genai/turn.ts:110](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L110) + +___ + +### create + +▸ **create**(`opts?`): [`Turn`](./turn) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`TurnInit`](../interfaces/turninit) & \{ `conversationId?`: `string` } | + +#### Returns + +[`Turn`](./turn) + +#### Defined in + +[genai/turn.ts:61](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L61) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/weaveclient.mdx b/weave/reference/typescript-sdk/classes/weaveclient.mdx index f4ba9ad90a..b683b311e0 100644 --- a/weave/reference/typescript-sdk/classes/weaveclient.mdx +++ b/weave/reference/typescript-sdk/classes/weaveclient.mdx @@ -31,6 +31,7 @@ description: "TypeScript SDK reference" - [getCalls](./weaveclient#getcalls) - [getCallsIterator](./weaveclient#getcallsiterator) - [getCurrentAttributes](./weaveclient#getcurrentattributes) +- [linkPromptToRegistry](./weaveclient#linkprompttoregistry) - [publish](./weaveclient#publish) - [pushNewCall](./weaveclient#pushnewcall) - [runWithAttributes](./weaveclient#runwithattributes) @@ -63,7 +64,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveClient.ts:100](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L100) +[weaveClient.ts:190](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L190) ## Properties @@ -73,7 +74,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveClient.ts:103](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L103) +[weaveClient.ts:193](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L193) ___ @@ -83,7 +84,7 @@ ___ #### Defined in -[weaveClient.ts:104](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L104) +[weaveClient.ts:194](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L194) ___ @@ -93,7 +94,7 @@ ___ #### Defined in -[weaveClient.ts:101](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L101) +[weaveClient.ts:191](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L191) ## Methods @@ -119,7 +120,7 @@ Used in imperative evaluation to attach scorer results to predict calls. #### Defined in -[weaveClient.ts:908](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L908) +[weaveClient.ts:1128](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L1128) ___ @@ -148,7 +149,7 @@ ___ #### Defined in -[weaveClient.ts:763](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L763) +[weaveClient.ts:975](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L975) ___ @@ -174,7 +175,7 @@ ___ #### Defined in -[weaveClient.ts:815](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L815) +[weaveClient.ts:1035](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L1035) ___ @@ -199,7 +200,7 @@ ___ #### Defined in -[weaveClient.ts:855](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L855) +[weaveClient.ts:1075](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L1075) ___ @@ -219,7 +220,7 @@ ___ #### Defined in -[weaveClient.ts:289](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L289) +[weaveClient.ts:435](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L435) ___ @@ -240,7 +241,7 @@ ___ #### Defined in -[weaveClient.ts:220](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L220) +[weaveClient.ts:312](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L312) ___ @@ -254,21 +255,19 @@ ___ #### Defined in -[weaveClient.ts:674](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L674) +[weaveClient.ts:886](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L886) ___ ### getCalls -▸ **getCalls**(`filter?`, `includeCosts?`, `limit?`): `Promise`\<`Call`[]\> +▸ **getCalls**(`options?`): `Promise`\<`Call`[]\> #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `filter` | [`CallsFilter`](../interfaces/callsfilter) | `{}` | -| `includeCosts` | `boolean` | `false` | -| `limit` | `number` | `1000` | +| Name | Type | +| :------ | :------ | +| `options?` | [`GetCallsOptions`](../interfaces/getcallsoptions) | #### Returns @@ -276,21 +275,55 @@ ___ #### Defined in -[weaveClient.ts:230](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L230) +[weaveClient.ts:345](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L345) + +▸ **getCalls**(`options?`, `includeCosts?`, `limit?`): `Promise`\<`Call`[]\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `options?` | [`CallsFilter`](../interfaces/callsfilter) | +| `includeCosts?` | `boolean` | +| `limit?` | `number` | + +#### Returns + +`Promise`\<`Call`[]\> + +#### Defined in + +[weaveClient.ts:346](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L346) ___ ### getCallsIterator -▸ **getCallsIterator**(`filter?`, `includeCosts?`, `limit?`): `AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema)\> +▸ **getCallsIterator**(`options?`, `includeCosts?`, `limit?`): `AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema)\> #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `filter` | [`CallsFilter`](../interfaces/callsfilter) | `{}` | -| `includeCosts` | `boolean` | `false` | -| `limit` | `number` | `1000` | +| Name | Type | +| :------ | :------ | +| `options?` | [`CallsFilter`](../interfaces/callsfilter) | +| `includeCosts?` | `boolean` | +| `limit?` | `number` | + +#### Returns + +`AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema)\> + +#### Defined in + +[weaveClient.ts:367](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L367) + +▸ **getCallsIterator**(`options?`): `AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `options?` | [`GetCallsOptions`](../interfaces/getcallsoptions) | #### Returns @@ -298,7 +331,7 @@ ___ #### Defined in -[weaveClient.ts:244](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L244) +[weaveClient.ts:372](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L372) ___ @@ -312,7 +345,30 @@ ___ #### Defined in -[weaveClient.ts:678](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L678) +[weaveClient.ts:890](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L890) + +___ + +### linkPromptToRegistry + +▸ **linkPromptToRegistry**(`prompt`, `options`): `Promise`\<`LinkAssetToRegistryRes`\> + +Link a published prompt version into a registry portfolio. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `prompt` | `RegistryLinkable` | +| `options` | `LinkPromptToRegistryOptions` | + +#### Returns + +`Promise`\<`LinkAssetToRegistryRes`\> + +#### Defined in + +[weaveClient.ts:591](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L591) ___ @@ -333,7 +389,7 @@ ___ #### Defined in -[weaveClient.ts:208](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L208) +[weaveClient.ts:300](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L300) ___ @@ -353,7 +409,7 @@ ___ #### Defined in -[weaveClient.ts:682](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L682) +[weaveClient.ts:894](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L894) ___ @@ -380,7 +436,7 @@ ___ #### Defined in -[weaveClient.ts:690](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L690) +[weaveClient.ts:902](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L902) ___ @@ -407,7 +463,7 @@ ___ #### Defined in -[weaveClient.ts:686](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L686) +[weaveClient.ts:898](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L898) ___ @@ -427,7 +483,7 @@ ___ #### Defined in -[weaveClient.ts:669](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L669) +[weaveClient.ts:881](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L881) ___ @@ -447,13 +503,13 @@ ___ #### Defined in -[weaveClient.ts:664](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L664) +[weaveClient.ts:876](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L876) ___ ### saveOp -▸ **saveOp**(`op`, `objId?`): `Promise`\<`any`\> +▸ **saveOp**(`op`, `objId?`): `Promise`\<`OpRef`\> #### Parameters @@ -464,17 +520,17 @@ ___ #### Returns -`Promise`\<`any`\> +`Promise`\<`OpRef`\> #### Defined in -[weaveClient.ts:729](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L729) +[weaveClient.ts:941](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L941) ___ ### serializeAudio -▸ **serializeAudio**(`data`, `audioType?`): `Promise`\<`any`\> +▸ **serializeAudio**(`data`, `audioType?`): `Promise`\<`SerializedFileBlob`\> Upload raw audio bytes to the Weave content store and return the `CustomWeaveType` placeholder that can be embedded in a call output. @@ -491,11 +547,11 @@ where the automatic serialization pipeline from `finishCall` is not used. #### Returns -`Promise`\<`any`\> +`Promise`\<`SerializedFileBlob`\> #### Defined in -[weaveClient.ts:616](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L616) +[weaveClient.ts:828](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L828) ___ @@ -516,7 +572,7 @@ ___ #### Defined in -[weaveClient.ts:891](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L891) +[weaveClient.ts:1111](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L1111) ___ @@ -530,4 +586,4 @@ ___ #### Defined in -[weaveClient.ts:121](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveClient.ts#L121) \ No newline at end of file +[weaveClient.ts:211](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L211) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/weaveobject.mdx b/weave/reference/typescript-sdk/classes/weaveobject.mdx index b4af0bfb7c..06e01ead1d 100644 --- a/weave/reference/typescript-sdk/classes/weaveobject.mdx +++ b/weave/reference/typescript-sdk/classes/weaveobject.mdx @@ -52,7 +52,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveObject.ts:75](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L75) +[weaveObject.ts:75](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L75) ## Properties @@ -62,7 +62,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveObject.ts:73](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L73) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L73) ## Accessors @@ -76,7 +76,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveObject.ts:100](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L100) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L100) ___ @@ -90,7 +90,7 @@ ___ #### Defined in -[weaveObject.ts:96](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L96) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -104,4 +104,4 @@ ___ #### Defined in -[weaveObject.ts:77](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx b/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx index 629fa4be5c..f0be0d5954 100644 --- a/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx +++ b/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx @@ -27,6 +27,6 @@ addTraceProcessor(processor); #### Defined in -[integrations/openai.agent.ts:612](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/integrations/openai.agent.ts#L612) +[integrations/openai.agent.ts:665](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/integrations/openai.agent.ts#L665) ___ diff --git a/weave/reference/typescript-sdk/functions/createotelextension.mdx b/weave/reference/typescript-sdk/functions/createotelextension.mdx new file mode 100644 index 0000000000..f63c384a31 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/createotelextension.mdx @@ -0,0 +1,51 @@ +--- +title: "createOtelExtension" +description: "TypeScript SDK reference" +--- + +# createOtelExtension + +▸ **createOtelExtension**(`opts?`): (`pi`: `PiExtensionApi`) => `void` + +Creates a pi coding agent extension that emits OTEL spans for the full +agent lifecycle, conforming to the GenAI semantic conventions. + +When `weave.init(...)` has been called, spans are automatically exported +to the Weave trace server at `/agents/otel/v1/traces`. Otherwise, pass a +custom `tracer` in `opts`. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | `OtelExtensionOptions` | + +#### Returns + +`fn` + +▸ (`pi`): `void` + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `pi` | `PiExtensionApi` | + +##### Returns + +`void` + +`Example` + +```typescript +const resourceLoader = new DefaultResourceLoader({ + extensionFactories: [createOtelExtension()], +}); +``` + +#### Defined in + +[integrations/piCodingAgent.ts:629](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/integrations/piCodingAgent.ts#L629) + +___ diff --git a/weave/reference/typescript-sdk/functions/endllm.mdx b/weave/reference/typescript-sdk/functions/endllm.mdx new file mode 100644 index 0000000000..7033f1295a --- /dev/null +++ b/weave/reference/typescript-sdk/functions/endllm.mdx @@ -0,0 +1,20 @@ +--- +title: "endLLM" +description: "TypeScript SDK reference" +--- + +# endLLM + +▸ **endLLM**(): `void` + +End the current LLM. No-op if no LLM is active. + +#### Returns + +`void` + +#### Defined in + +[genai/api.ts:102](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L102) + +___ diff --git a/weave/reference/typescript-sdk/functions/endsession.mdx b/weave/reference/typescript-sdk/functions/endsession.mdx new file mode 100644 index 0000000000..39b6eddd02 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/endsession.mdx @@ -0,0 +1,20 @@ +--- +title: "endSession" +description: "TypeScript SDK reference" +--- + +# endSession + +▸ **endSession**(): `void` + +End the current Session. No-op if no Session is active. + +#### Returns + +`void` + +#### Defined in + +[genai/api.ts:82](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L82) + +___ diff --git a/weave/reference/typescript-sdk/functions/endturn.mdx b/weave/reference/typescript-sdk/functions/endturn.mdx new file mode 100644 index 0000000000..45646309c0 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/endturn.mdx @@ -0,0 +1,20 @@ +--- +title: "endTurn" +description: "TypeScript SDK reference" +--- + +# endTurn + +▸ **endTurn**(): `void` + +End the current Turn. No-op if no Turn is active. + +#### Returns + +`void` + +#### Defined in + +[genai/api.ts:92](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L92) + +___ diff --git a/weave/reference/typescript-sdk/functions/flushotel.mdx b/weave/reference/typescript-sdk/functions/flushotel.mdx new file mode 100644 index 0000000000..d226271d37 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/flushotel.mdx @@ -0,0 +1,29 @@ +--- +title: "flushOTel" +description: "TypeScript SDK reference" +--- + +# flushOTel + +▸ **flushOTel**(): `Promise`\<`void`\> + +Force-flush any GenAI spans buffered by the active span processor. + +Resolves immediately if `weave.init()` has not been called. Otherwise +delegates to `BasicTracerProvider.forceFlush()`, which waits for the +underlying span processor to drain its queue and complete its OTLP export +round-trip. + +Call before process exit when using `'simple'` or any other processor that +may have in-flight work, or in tests that need to observe exported spans +synchronously. + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[genai/flush.ts:15](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/flush.ts#L15) + +___ diff --git a/weave/reference/typescript-sdk/functions/getcurrentllm.mdx b/weave/reference/typescript-sdk/functions/getcurrentllm.mdx new file mode 100644 index 0000000000..c17469f2b0 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/getcurrentllm.mdx @@ -0,0 +1,20 @@ +--- +title: "getCurrentLLM" +description: "TypeScript SDK reference" +--- + +# getCurrentLLM + +▸ **getCurrentLLM**(): [`LLM`](../classes/llm) \| `undefined` + +Returns the current LLM, or undefined. + +#### Returns + +[`LLM`](../classes/llm) \| `undefined` + +#### Defined in + +[genai/context.ts:103](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/context.ts#L103) + +___ diff --git a/weave/reference/typescript-sdk/functions/getcurrentsession.mdx b/weave/reference/typescript-sdk/functions/getcurrentsession.mdx new file mode 100644 index 0000000000..9eee56ef75 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/getcurrentsession.mdx @@ -0,0 +1,20 @@ +--- +title: "getCurrentSession" +description: "TypeScript SDK reference" +--- + +# getCurrentSession + +▸ **getCurrentSession**(): [`Session`](../classes/session) \| `undefined` + +Returns the current Session, or undefined. + +#### Returns + +[`Session`](../classes/session) \| `undefined` + +#### Defined in + +[genai/context.ts:93](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/context.ts#L93) + +___ diff --git a/weave/reference/typescript-sdk/functions/getcurrentturn.mdx b/weave/reference/typescript-sdk/functions/getcurrentturn.mdx new file mode 100644 index 0000000000..8c3ad6b8b2 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/getcurrentturn.mdx @@ -0,0 +1,20 @@ +--- +title: "getCurrentTurn" +description: "TypeScript SDK reference" +--- + +# getCurrentTurn + +▸ **getCurrentTurn**(): [`Turn`](../classes/turn) \| `undefined` + +Returns the current Turn, or undefined. + +#### Returns + +[`Turn`](../classes/turn) \| `undefined` + +#### Defined in + +[genai/context.ts:98](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/context.ts#L98) + +___ diff --git a/weave/reference/typescript-sdk/functions/init.mdx b/weave/reference/typescript-sdk/functions/init.mdx index 473ef29dc6..23455bd1f2 100644 --- a/weave/reference/typescript-sdk/functions/init.mdx +++ b/weave/reference/typescript-sdk/functions/init.mdx @@ -13,7 +13,7 @@ Initialize the Weave client, which is required for weave tracing to work. | Name | Type | Description | | :------ | :------ | :------ | -| `project` | `string` | The W&B project name (can be project or entity/project). If you don't specify a W&B team (e.g., 'team/project'), your default entity is used. To find or update your default entity, refer to User Settings at https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team | +| `project` | `string` | The W&B project name (can be project or entity/project). If you don't specify a W&B team (e.g., 'team/project'), your default entity is used. To find or update your default entity, refer to User Settings at https://docs.wandb.ai/platform/app/settings-page/user-settings#default-team | | `settings?` | `SettingsInit` | (Optional) Weave tracing settings | #### Returns @@ -28,6 +28,6 @@ If the initialization fails #### Defined in -[clientApi.ts:83](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/clientApi.ts#L83) +[clientApi.ts:90](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/clientApi.ts#L90) ___ diff --git a/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx b/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx index 0e976ccdbe..a3f33dd6bb 100644 --- a/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx +++ b/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx @@ -22,7 +22,7 @@ throwing an error. `Promise`\<`boolean`\> -Promise\<`boolean`\> - true if registration succeeded, false if @openai/agents not available +Promise - true if registration succeeded, false if @openai/agents not available `Example` @@ -73,6 +73,6 @@ addTraceProcessor(processor); #### Defined in -[integrations/openai.agent.ts:674](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/integrations/openai.agent.ts#L674) +[integrations/openai.agent.ts:727](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/integrations/openai.agent.ts#L727) ___ diff --git a/weave/reference/typescript-sdk/functions/login.mdx b/weave/reference/typescript-sdk/functions/login.mdx index 1f4a825313..55cd7a92e4 100644 --- a/weave/reference/typescript-sdk/functions/login.mdx +++ b/weave/reference/typescript-sdk/functions/login.mdx @@ -28,6 +28,6 @@ If the API key is not specified or if the connection to the weave trace server c #### Defined in -[clientApi.ts:23](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/clientApi.ts#L23) +[clientApi.ts:30](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/clientApi.ts#L30) ___ diff --git a/weave/reference/typescript-sdk/functions/op.mdx b/weave/reference/typescript-sdk/functions/op.mdx index 0681c70a13..8731d5e065 100644 --- a/weave/reference/typescript-sdk/functions/op.mdx +++ b/weave/reference/typescript-sdk/functions/op.mdx @@ -26,7 +26,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:381](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/op.ts#L381) +[op.ts:381](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/op.ts#L381) ▸ **op**\<`T`\>(`thisArg`, `fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> @@ -50,7 +50,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:386](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/op.ts#L386) +[op.ts:386](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/op.ts#L386) ▸ **op**(`target`, `propertyKey`, `descriptor`): `TypedPropertyDescriptor`\<`any`\> @@ -68,7 +68,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:392](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/op.ts#L392) +[op.ts:392](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/op.ts#L392) ▸ **op**\<`T`\>(`value`, `context`): [`Op`](../type-aliases/op)\<`T`\> @@ -91,7 +91,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:398](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/op.ts#L398) +[op.ts:398](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/op.ts#L398) ▸ **op**(`options`): `MethodDecorator` @@ -107,6 +107,6 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:403](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/op.ts#L403) +[op.ts:403](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/op.ts#L403) ___ diff --git a/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx b/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx index 136cc414f0..ab2bca858a 100644 --- a/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx +++ b/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx @@ -5,7 +5,7 @@ description: "TypeScript SDK reference" # patchRealtimeSession -▸ **patchRealtimeSession**(): `void` +▸ **patchRealtimeSession**(): `Promise`\<`boolean`\> Manually patch the `RealtimeSession` class from `@openai/agents-realtime` so that every new instance is automatically traced by Weave. @@ -20,18 +20,21 @@ The function is idempotent — safe to call multiple times. #### Returns -`void` +`Promise`\<`boolean`\> + +`true` if the patch was applied (or was already in place), `false` if +`@openai/agents-realtime` could not be loaded. `Example` ```typescript import { patchRealtimeSession } from 'weave'; -patchRealtimeSession(); +await patchRealtimeSession(); // Every new RealtimeSession(...) is now auto-instrumented ``` #### Defined in -[integrations/openai.realtime.agent.ts:797](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/integrations/openai.realtime.agent.ts#L797) +[integrations/openai.realtime.agent.ts:808](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/integrations/openai.realtime.agent.ts#L808) ___ diff --git a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx index 98d598e0a4..833a282a68 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx @@ -13,6 +13,6 @@ description: "TypeScript SDK reference" #### Defined in -[clientApi.ts:147](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/clientApi.ts#L147) +[clientApi.ts:155](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/clientApi.ts#L155) ___ diff --git a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx index 7405e76972..b98c11f270 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx @@ -13,6 +13,6 @@ description: "TypeScript SDK reference" #### Defined in -[clientApi.ts:159](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/clientApi.ts#L159) +[clientApi.ts:167](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/clientApi.ts#L167) ___ diff --git a/weave/reference/typescript-sdk/functions/runisolated.mdx b/weave/reference/typescript-sdk/functions/runisolated.mdx new file mode 100644 index 0000000000..f9b822b4a9 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/runisolated.mdx @@ -0,0 +1,45 @@ +--- +title: "runIsolated" +description: "TypeScript SDK reference" +--- + +# runIsolated + +▸ **runIsolated**\<`T`\>(`fn`): `T` + +Run `fn` in a fresh, isolated GenAI state frame. Any Session / Turn / LLM +started inside `fn` lives in this frame only — it does not clash with +sibling `runIsolated` frames running concurrently, and it does not leak +to the outer async chain. + +Use this to safely run parallel GenAI work: + + await Promise.all([ + weave.runIsolated(async () => { ... }), + weave.runIsolated(async () => { ... }), + ]); + +Sequential single-flight usage doesn't require this wrapper — the +process-wide default state handles it. + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `fn` | () => `T` | + +#### Returns + +`T` + +#### Defined in + +[genai/context.ts:88](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/context.ts#L88) + +___ diff --git a/weave/reference/typescript-sdk/functions/startllm.mdx b/weave/reference/typescript-sdk/functions/startllm.mdx new file mode 100644 index 0000000000..aa7cce1ddf --- /dev/null +++ b/weave/reference/typescript-sdk/functions/startllm.mdx @@ -0,0 +1,27 @@ +--- +title: "startLLM" +description: "TypeScript SDK reference" +--- + +# startLLM + +▸ **startLLM**(`opts`): [`LLM`](../classes/llm) + +Start an LLM span as a child of the current Turn. Throws if no Turn is +active. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`LLMInit`](../interfaces/llminit) | + +#### Returns + +[`LLM`](../classes/llm) + +#### Defined in + +[genai/api.ts:32](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L32) + +___ diff --git a/weave/reference/typescript-sdk/functions/startsession.mdx b/weave/reference/typescript-sdk/functions/startsession.mdx new file mode 100644 index 0000000000..53f151e9f8 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/startsession.mdx @@ -0,0 +1,27 @@ +--- +title: "startSession" +description: "TypeScript SDK reference" +--- + +# startSession + +▸ **startSession**(`opts?`): [`Session`](../classes/session) + +Start a new Session and install it as the current session. +Subsequent calls to `startTurn` will pick it up automatically. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`SessionInit`](../interfaces/sessioninit) | + +#### Returns + +[`Session`](../classes/session) + +#### Defined in + +[genai/api.ts:12](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L12) + +___ diff --git a/weave/reference/typescript-sdk/functions/startsubagent.mdx b/weave/reference/typescript-sdk/functions/startsubagent.mdx new file mode 100644 index 0000000000..94839e25d4 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/startsubagent.mdx @@ -0,0 +1,26 @@ +--- +title: "startSubagent" +description: "TypeScript SDK reference" +--- + +# startSubagent + +▸ **startSubagent**(`opts`): [`SubAgent`](../classes/subagent) + +Start a SubAgent span. Same parent-resolution rules as `startTool`. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`SubAgentInit`](../interfaces/subagentinit) | + +#### Returns + +[`SubAgent`](../classes/subagent) + +#### Defined in + +[genai/api.ts:66](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L66) + +___ diff --git a/weave/reference/typescript-sdk/functions/starttool.mdx b/weave/reference/typescript-sdk/functions/starttool.mdx new file mode 100644 index 0000000000..e2b0425222 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/starttool.mdx @@ -0,0 +1,31 @@ +--- +title: "startTool" +description: "TypeScript SDK reference" +--- + +# startTool + +▸ **startTool**(`opts`): [`Tool`](../classes/tool) + +Start a Tool span. Parent resolution (matches the design's "flat by +default, hierarchical if you nest"): +- If an LLM is active, the Tool nests under it. +- Otherwise, the Tool is a sibling under the current Turn. + +Throws if neither a Turn nor an LLM is active. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`ToolInit`](../interfaces/toolinit) | + +#### Returns + +[`Tool`](../classes/tool) + +#### Defined in + +[genai/api.ts:50](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L50) + +___ diff --git a/weave/reference/typescript-sdk/functions/startturn.mdx b/weave/reference/typescript-sdk/functions/startturn.mdx new file mode 100644 index 0000000000..ea70db891c --- /dev/null +++ b/weave/reference/typescript-sdk/functions/startturn.mdx @@ -0,0 +1,27 @@ +--- +title: "startTurn" +description: "TypeScript SDK reference" +--- + +# startTurn + +▸ **startTurn**(`opts?`): [`Turn`](../classes/turn) + +Start a new Turn. If a Session is active, the turn inherits its +`conversationId`; otherwise the turn has no conversation id. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`TurnInit`](../interfaces/turninit) | + +#### Returns + +[`Turn`](../classes/turn) + +#### Defined in + +[genai/api.ts:20](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/api.ts#L20) + +___ diff --git a/weave/reference/typescript-sdk/functions/weaveaudio.mdx b/weave/reference/typescript-sdk/functions/weaveaudio.mdx index 749c8d4331..70de8a9286 100644 --- a/weave/reference/typescript-sdk/functions/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/functions/weaveaudio.mdx @@ -28,6 +28,6 @@ const weaveAudio = weaveAudio({ data: audioBuffer }); #### Defined in -[media.ts:62](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L62) +[media.ts:62](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L62) ___ diff --git a/weave/reference/typescript-sdk/functions/weaveimage.mdx b/weave/reference/typescript-sdk/functions/weaveimage.mdx index e81a5c72a1..b167756017 100644 --- a/weave/reference/typescript-sdk/functions/weaveimage.mdx +++ b/weave/reference/typescript-sdk/functions/weaveimage.mdx @@ -28,6 +28,6 @@ const weaveImage = weaveImage({ data: imageBuffer }); #### Defined in -[media.ts:28](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L28) +[media.ts:28](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L28) ___ diff --git a/weave/reference/typescript-sdk/functions/withattributes.mdx b/weave/reference/typescript-sdk/functions/withattributes.mdx index b4b6cb2a0c..b058a05835 100644 --- a/weave/reference/typescript-sdk/functions/withattributes.mdx +++ b/weave/reference/typescript-sdk/functions/withattributes.mdx @@ -38,6 +38,6 @@ await withAttributes({requestId: 'abc'}, async () => { #### Defined in -[clientApi.ts:193](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/clientApi.ts#L193) +[clientApi.ts:201](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/clientApi.ts#L201) ___ diff --git a/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx b/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx index e0bd88e73c..d34105f05b 100644 --- a/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx @@ -25,6 +25,6 @@ description: "TypeScript SDK reference" #### Defined in -[integrations/googleGenAI.ts:223](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/integrations/googleGenAI.ts#L223) +[integrations/googleGenAI.ts:223](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/integrations/googleGenAI.ts#L223) ___ diff --git a/weave/reference/typescript-sdk/functions/wrapopenai.mdx b/weave/reference/typescript-sdk/functions/wrapopenai.mdx index 506a12296c..d905add33b 100644 --- a/weave/reference/typescript-sdk/functions/wrapopenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapopenai.mdx @@ -37,4 +37,4 @@ const result = await openai.chat.completions.create({ #### Defined in -[integrations/openai.ts:505](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/integrations/openai.ts#L505) \ No newline at end of file +[integrations/openai.ts:703](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/integrations/openai.ts#L703) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/callschema.mdx b/weave/reference/typescript-sdk/interfaces/callschema.mdx index 53387ef4a7..9e0ae65ac5 100644 --- a/weave/reference/typescript-sdk/interfaces/callschema.mdx +++ b/weave/reference/typescript-sdk/interfaces/callschema.mdx @@ -40,7 +40,7 @@ Attributes #### Defined in -[generated/traceServerApi.ts:118](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L118) +[generated/traceServerApi.ts:120](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L120) ___ @@ -52,7 +52,7 @@ Deleted At #### Defined in -[generated/traceServerApi.ts:133](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L133) +[generated/traceServerApi.ts:135](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L135) ___ @@ -64,7 +64,7 @@ Display Name #### Defined in -[generated/traceServerApi.ts:107](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L107) +[generated/traceServerApi.ts:109](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L109) ___ @@ -76,7 +76,7 @@ Ended At #### Defined in -[generated/traceServerApi.ts:122](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L122) +[generated/traceServerApi.ts:124](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L124) ___ @@ -88,7 +88,7 @@ Exception #### Defined in -[generated/traceServerApi.ts:124](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L124) +[generated/traceServerApi.ts:126](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L126) ___ @@ -100,7 +100,7 @@ Id #### Defined in -[generated/traceServerApi.ts:101](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L101) +[generated/traceServerApi.ts:103](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L103) ___ @@ -112,7 +112,7 @@ Inputs #### Defined in -[generated/traceServerApi.ts:120](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L120) +[generated/traceServerApi.ts:122](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L122) ___ @@ -124,7 +124,7 @@ Op Name #### Defined in -[generated/traceServerApi.ts:105](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L105) +[generated/traceServerApi.ts:107](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L107) ___ @@ -136,7 +136,7 @@ Output #### Defined in -[generated/traceServerApi.ts:126](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L126) +[generated/traceServerApi.ts:128](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L128) ___ @@ -148,7 +148,7 @@ Parent Id #### Defined in -[generated/traceServerApi.ts:111](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L111) +[generated/traceServerApi.ts:113](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L113) ___ @@ -160,7 +160,7 @@ Project Id #### Defined in -[generated/traceServerApi.ts:103](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L103) +[generated/traceServerApi.ts:105](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L105) ___ @@ -176,7 +176,7 @@ date-time #### Defined in -[generated/traceServerApi.ts:116](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L116) +[generated/traceServerApi.ts:118](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L118) ___ @@ -186,7 +186,7 @@ ___ #### Defined in -[generated/traceServerApi.ts:127](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L127) +[generated/traceServerApi.ts:129](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L129) ___ @@ -198,7 +198,7 @@ Trace Id #### Defined in -[generated/traceServerApi.ts:109](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L109) +[generated/traceServerApi.ts:111](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L111) ___ @@ -210,7 +210,7 @@ Wb Run Id #### Defined in -[generated/traceServerApi.ts:131](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L131) +[generated/traceServerApi.ts:133](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L133) ___ @@ -222,4 +222,4 @@ Wb User Id #### Defined in -[generated/traceServerApi.ts:129](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L129) \ No newline at end of file +[generated/traceServerApi.ts:131](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L131) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/callsfilter.mdx b/weave/reference/typescript-sdk/interfaces/callsfilter.mdx index e939523978..6d74a9c24d 100644 --- a/weave/reference/typescript-sdk/interfaces/callsfilter.mdx +++ b/weave/reference/typescript-sdk/interfaces/callsfilter.mdx @@ -33,7 +33,7 @@ Call Ids #### Defined in -[generated/traceServerApi.ts:196](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L196) +[generated/traceServerApi.ts:198](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L198) ___ @@ -45,7 +45,7 @@ Input Refs #### Defined in -[generated/traceServerApi.ts:188](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L188) +[generated/traceServerApi.ts:190](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L190) ___ @@ -57,7 +57,7 @@ Op Names #### Defined in -[generated/traceServerApi.ts:186](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L186) +[generated/traceServerApi.ts:188](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L188) ___ @@ -69,7 +69,7 @@ Output Refs #### Defined in -[generated/traceServerApi.ts:190](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L190) +[generated/traceServerApi.ts:192](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L192) ___ @@ -81,7 +81,7 @@ Parent Ids #### Defined in -[generated/traceServerApi.ts:192](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L192) +[generated/traceServerApi.ts:194](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L194) ___ @@ -93,7 +93,7 @@ Trace Ids #### Defined in -[generated/traceServerApi.ts:194](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L194) +[generated/traceServerApi.ts:196](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L196) ___ @@ -105,7 +105,7 @@ Trace Roots Only #### Defined in -[generated/traceServerApi.ts:198](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L198) +[generated/traceServerApi.ts:200](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L200) ___ @@ -117,7 +117,7 @@ Wb Run Ids #### Defined in -[generated/traceServerApi.ts:202](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L202) +[generated/traceServerApi.ts:204](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L204) ___ @@ -129,4 +129,4 @@ Wb User Ids #### Defined in -[generated/traceServerApi.ts:200](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/generated/traceServerApi.ts#L200) \ No newline at end of file +[generated/traceServerApi.ts:202](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L202) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx b/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx new file mode 100644 index 0000000000..b79076d66f --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx @@ -0,0 +1,112 @@ +--- +title: "Interface: GetCallsOptions" +description: "TypeScript SDK reference" +--- + +[weave](../) / GetCallsOptions + + + +## Table of contents + +### Properties + +- [columns](./getcallsoptions#columns) +- [expandColumns](./getcallsoptions#expandcolumns) +- [filter](./getcallsoptions#filter) +- [includeCosts](./getcallsoptions#includecosts) +- [includeFeedback](./getcallsoptions#includefeedback) +- [limit](./getcallsoptions#limit) +- [offset](./getcallsoptions#offset) +- [query](./getcallsoptions#query) +- [sortBy](./getcallsoptions#sortby) + +## Properties + +### columns + +• `Optional` **columns**: `string`[] + +#### Defined in + +[weaveClient.ts:84](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L84) + +___ + +### expandColumns + +• `Optional` **expandColumns**: `string`[] + +#### Defined in + +[weaveClient.ts:85](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L85) + +___ + +### filter + +• `Optional` **filter**: [`CallsFilter`](./callsfilter) + +#### Defined in + +[weaveClient.ts:77](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L77) + +___ + +### includeCosts + +• `Optional` **includeCosts**: `boolean` + +#### Defined in + +[weaveClient.ts:79](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L79) + +___ + +### includeFeedback + +• `Optional` **includeFeedback**: `boolean` + +#### Defined in + +[weaveClient.ts:80](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L80) + +___ + +### limit + +• `Optional` **limit**: `number` + +#### Defined in + +[weaveClient.ts:81](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L81) + +___ + +### offset + +• `Optional` **offset**: `number` + +#### Defined in + +[weaveClient.ts:82](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L82) + +___ + +### query + +• `Optional` **query**: [`Query`](./query) + +#### Defined in + +[weaveClient.ts:78](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L78) + +___ + +### sortBy + +• `Optional` **sortBy**: [`SortBy`](./sortby)[] + +#### Defined in + +[weaveClient.ts:83](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/weaveClient.ts#L83) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/llminit.mdx b/weave/reference/typescript-sdk/interfaces/llminit.mdx new file mode 100644 index 0000000000..8f2dce737d --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/llminit.mdx @@ -0,0 +1,35 @@ +--- +title: "Interface: LLMInit" +description: "TypeScript SDK reference" +--- + +[weave](../) / LLMInit + + + +## Table of contents + +### Properties + +- [model](./llminit#model) +- [providerName](./llminit#providername) + +## Properties + +### model + +• **model**: `string` + +#### Defined in + +[genai/llm.ts:31](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L31) + +___ + +### providerName + +• `Optional` **providerName**: `string` + +#### Defined in + +[genai/llm.ts:32](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/llm.ts#L32) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/message.mdx b/weave/reference/typescript-sdk/interfaces/message.mdx new file mode 100644 index 0000000000..bcbfb17767 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/message.mdx @@ -0,0 +1,68 @@ +--- +title: "Interface: Message" +description: "TypeScript SDK reference" +--- + +[weave](../) / Message + + + +## Table of contents + +### Properties + +- [content](./message#content) +- [parts](./message#parts) +- [role](./message#role) +- [toolCallId](./message#toolcallid) +- [toolName](./message#toolname) + +## Properties + +### content + +• `Optional` **content**: `string` + +#### Defined in + +[genai/types.ts:11](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L11) + +___ + +### parts + +• `Optional` **parts**: [`MessagePart`](../#messagepart)[] + +#### Defined in + +[genai/types.ts:14](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L14) + +___ + +### role + +• **role**: [`Role`](../#role) + +#### Defined in + +[genai/types.ts:10](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L10) + +___ + +### toolCallId + +• `Optional` **toolCallId**: `string` + +#### Defined in + +[genai/types.ts:12](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L12) + +___ + +### toolName + +• `Optional` **toolName**: `string` + +#### Defined in + +[genai/types.ts:13](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L13) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/query.mdx b/weave/reference/typescript-sdk/interfaces/query.mdx new file mode 100644 index 0000000000..a418a8daa0 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/query.mdx @@ -0,0 +1,28 @@ +--- +title: "Interface: Query" +description: "TypeScript SDK reference" +--- + +[weave](../) / Query + + + +Query + +## Table of contents + +### Properties + +- [$expr](./query#$expr) + +## Properties + +### $expr + +• **$expr**: `AndOperation` \| `OrOperation` \| `NotOperation` \| `EqOperation` \| `GtOperation` \| `GteOperation` \| `InOperation` \| `ContainsOperation` + +$Expr + +#### Defined in + +[generated/traceServerApi.ts:817](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L817) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/reasoning.mdx b/weave/reference/typescript-sdk/interfaces/reasoning.mdx new file mode 100644 index 0000000000..135627c365 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/reasoning.mdx @@ -0,0 +1,24 @@ +--- +title: "Interface: Reasoning" +description: "TypeScript SDK reference" +--- + +[weave](../) / Reasoning + + + +## Table of contents + +### Properties + +- [content](./reasoning#content) + +## Properties + +### content + +• **content**: `string` + +#### Defined in + +[genai/types.ts:40](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L40) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/sessioninit.mdx b/weave/reference/typescript-sdk/interfaces/sessioninit.mdx new file mode 100644 index 0000000000..b49bd7b604 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/sessioninit.mdx @@ -0,0 +1,49 @@ +--- +title: "Interface: SessionInit" +description: "TypeScript SDK reference" +--- + +[weave](../) / SessionInit + + + +## Table of contents + +### Properties + +- [agentName](./sessioninit#agentname) +- [model](./sessioninit#model) +- [sessionId](./sessioninit#sessionid) + +## Properties + +### agentName + +• `Optional` **agentName**: `string` + +#### Defined in + +[genai/session.ts:7](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L7) + +___ + +### model + +• `Optional` **model**: `string` + +#### Defined in + +[genai/session.ts:8](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L8) + +___ + +### sessionId + +• `Optional` **sessionId**: `string` + +Conversation ID propagated to every span under this session as + `gen_ai.conversation.id`. Auto-generated if omitted. + +#### Defined in + +[genai/session.ts:11](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/session.ts#L11) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/sortby.mdx b/weave/reference/typescript-sdk/interfaces/sortby.mdx new file mode 100644 index 0000000000..a6da5ee14d --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/sortby.mdx @@ -0,0 +1,41 @@ +--- +title: "Interface: SortBy" +description: "TypeScript SDK reference" +--- + +[weave](../) / SortBy + + + +SortBy + +## Table of contents + +### Properties + +- [direction](./sortby#direction) +- [field](./sortby#field) + +## Properties + +### direction + +• **direction**: ``"asc"`` \| ``"desc"`` + +Direction + +#### Defined in + +[generated/traceServerApi.ts:851](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L851) + +___ + +### field + +• **field**: `string` + +Field + +#### Defined in + +[generated/traceServerApi.ts:849](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/generated/traceServerApi.ts#L849) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/subagentinit.mdx b/weave/reference/typescript-sdk/interfaces/subagentinit.mdx new file mode 100644 index 0000000000..88b7224c75 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/subagentinit.mdx @@ -0,0 +1,35 @@ +--- +title: "Interface: SubAgentInit" +description: "TypeScript SDK reference" +--- + +[weave](../) / SubAgentInit + + + +## Table of contents + +### Properties + +- [model](./subagentinit#model) +- [name](./subagentinit#name) + +## Properties + +### model + +• `Optional` **model**: `string` + +#### Defined in + +[genai/subagent.ts:15](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/subagent.ts#L15) + +___ + +### name + +• **name**: `string` + +#### Defined in + +[genai/subagent.ts:14](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/subagent.ts#L14) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/toolinit.mdx b/weave/reference/typescript-sdk/interfaces/toolinit.mdx new file mode 100644 index 0000000000..1f2cd3d14f --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/toolinit.mdx @@ -0,0 +1,46 @@ +--- +title: "Interface: ToolInit" +description: "TypeScript SDK reference" +--- + +[weave](../) / ToolInit + + + +## Table of contents + +### Properties + +- [args](./toolinit#args) +- [name](./toolinit#name) +- [toolCallId](./toolinit#toolcallid) + +## Properties + +### args + +• `Optional` **args**: `string` + +#### Defined in + +[genai/tool.ts:17](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L17) + +___ + +### name + +• **name**: `string` + +#### Defined in + +[genai/tool.ts:16](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L16) + +___ + +### toolCallId + +• `Optional` **toolCallId**: `string` + +#### Defined in + +[genai/tool.ts:18](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/tool.ts#L18) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/turninit.mdx b/weave/reference/typescript-sdk/interfaces/turninit.mdx new file mode 100644 index 0000000000..046839590f --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/turninit.mdx @@ -0,0 +1,35 @@ +--- +title: "Interface: TurnInit" +description: "TypeScript SDK reference" +--- + +[weave](../) / TurnInit + + + +## Table of contents + +### Properties + +- [agentName](./turninit#agentname) +- [model](./turninit#model) + +## Properties + +### agentName + +• `Optional` **agentName**: `string` + +#### Defined in + +[genai/turn.ts:24](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L24) + +___ + +### model + +• `Optional` **model**: `string` + +#### Defined in + +[genai/turn.ts:25](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/turn.ts#L25) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/usage.mdx b/weave/reference/typescript-sdk/interfaces/usage.mdx new file mode 100644 index 0000000000..01ab652995 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/usage.mdx @@ -0,0 +1,68 @@ +--- +title: "Interface: Usage" +description: "TypeScript SDK reference" +--- + +[weave](../) / Usage + + + +## Table of contents + +### Properties + +- [cacheCreationInputTokens](./usage#cachecreationinputtokens) +- [cacheReadInputTokens](./usage#cachereadinputtokens) +- [inputTokens](./usage#inputtokens) +- [outputTokens](./usage#outputtokens) +- [reasoningTokens](./usage#reasoningtokens) + +## Properties + +### cacheCreationInputTokens + +• `Optional` **cacheCreationInputTokens**: `number` + +#### Defined in + +[genai/types.ts:35](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L35) + +___ + +### cacheReadInputTokens + +• `Optional` **cacheReadInputTokens**: `number` + +#### Defined in + +[genai/types.ts:36](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L36) + +___ + +### inputTokens + +• `Optional` **inputTokens**: `number` + +#### Defined in + +[genai/types.ts:32](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L32) + +___ + +### outputTokens + +• `Optional` **outputTokens**: `number` + +#### Defined in + +[genai/types.ts:33](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L33) + +___ + +### reasoningTokens + +• `Optional` **reasoningTokens**: `number` + +#### Defined in + +[genai/types.ts:34](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L34) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx b/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx index fa3eb4a21e..775ceda4cc 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx @@ -29,7 +29,7 @@ description: "TypeScript SDK reference" #### Defined in -[media.ts:48](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L48) +[media.ts:48](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L48) ___ @@ -43,7 +43,7 @@ WeaveAudioInput.audioType #### Defined in -[media.ts:44](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L44) +[media.ts:44](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L44) ___ @@ -57,4 +57,4 @@ WeaveAudioInput.data #### Defined in -[media.ts:43](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L43) \ No newline at end of file +[media.ts:43](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L43) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx index c00c10026a..eee090362a 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx @@ -29,7 +29,7 @@ description: "TypeScript SDK reference" #### Defined in -[media.ts:14](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L14) +[media.ts:14](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L14) ___ @@ -43,7 +43,7 @@ WeaveImageInput.data #### Defined in -[media.ts:9](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L9) +[media.ts:9](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L9) ___ @@ -57,4 +57,4 @@ WeaveImageInput.imageType #### Defined in -[media.ts:10](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/media.ts#L10) \ No newline at end of file +[media.ts:10](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/media.ts#L10) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/messagepart.mdx b/weave/reference/typescript-sdk/type-aliases/messagepart.mdx new file mode 100644 index 0000000000..9d2c893596 --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/messagepart.mdx @@ -0,0 +1,14 @@ +--- +title: "MessagePart" +description: "TypeScript SDK reference" +--- + +# MessagePart + +Ƭ **MessagePart**: \{ `content`: `string` ; `type`: ``"text"`` } \| \{ `content`: `string` ; `type`: ``"reasoning"`` } \| \{ `arguments?`: `string` ; `toolCallId`: `string` ; `toolName`: `string` ; `type`: ``"tool_call"`` } \| \{ `result?`: `string` ; `toolCallId`: `string` ; `type`: ``"tool_result"`` } \| \{ `fileId`: `string` ; `mimeType?`: `string` ; `modality`: [`Modality`](./modality) ; `type`: ``"file"`` } \| \{ `content`: `string` ; `mimeType`: `string` ; `modality`: [`Modality`](./modality) ; `type`: ``"blob"`` } \| \{ `modality`: [`Modality`](./modality) ; `type`: ``"uri"`` ; `uri`: `string` } + +#### Defined in + +[genai/types.ts:17](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L17) + +___ diff --git a/weave/reference/typescript-sdk/type-aliases/modality.mdx b/weave/reference/typescript-sdk/type-aliases/modality.mdx new file mode 100644 index 0000000000..8b57e08abc --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/modality.mdx @@ -0,0 +1,14 @@ +--- +title: "Modality" +description: "TypeScript SDK reference" +--- + +# Modality + +Ƭ **Modality**: ``"image"`` \| ``"audio"`` \| ``"video"`` \| ``"document"`` + +#### Defined in + +[genai/types.ts:7](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L7) + +___ diff --git a/weave/reference/typescript-sdk/type-aliases/op.mdx b/weave/reference/typescript-sdk/type-aliases/op.mdx index 60ab2ba440..2bc0ecf2a2 100644 --- a/weave/reference/typescript-sdk/type-aliases/op.mdx +++ b/weave/reference/typescript-sdk/type-aliases/op.mdx @@ -15,6 +15,6 @@ description: "TypeScript SDK reference" #### Defined in -[opType.ts:7](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/opType.ts#L7) +[opType.ts:7](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/opType.ts#L7) ___ diff --git a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx index 5fe24e796c..153ab356a6 100644 --- a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx +++ b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx @@ -27,19 +27,6 @@ For legacy decorators: #### Defined in -[opType.ts:41](https://github.com/wandb/weave/blob/62f1e46098095776ee29b730ad10b3b3d1a68307/sdks/node/src/opType.ts#L41) - -## Functions - - - - - - - - - - - - +[opType.ts:41](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/opType.ts#L41) +___ diff --git a/weave/reference/typescript-sdk/type-aliases/role.mdx b/weave/reference/typescript-sdk/type-aliases/role.mdx new file mode 100644 index 0000000000..9889bb7abf --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/role.mdx @@ -0,0 +1,43 @@ +--- +title: "Role" +description: "TypeScript SDK reference" +--- + +# Role + +Ƭ **Role**: ``"user"`` \| ``"assistant"`` \| ``"system"`` \| ``"tool"`` + +Public data types for the Weave GenAI session SDK. + +#### Defined in + +[genai/types.ts:5](https://github.com/wandb/weave/blob/6d1ea4600b8b01c98d2636433c2989c4d163539e/sdks/node/src/genai/types.ts#L5) + +## Functions + + + + + + + + + + + + + + + + + + + + + + + + + + +