From 02decd1ed8cd060fed3283d52ceea9796c455405 Mon Sep 17 00:00:00 2001 From: dbrian57 Date: Tue, 21 Jul 2026 17:47:25 -0400 Subject: [PATCH] Upgrade Weave TS SDK docs generation to TypeDoc 0.28 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps typedoc 0.25.13 → 0.28.20 and typedoc-plugin-markdown 3.17.1 → 4.12.0, and regenerates the TypeScript SDK reference from weave v0.53.2-ts. The old pins no longer worked: TypeDoc 0.25 rejects the TypeScript 5.9 the Weave SDK now uses, and aborts on an upstream type error in weave's googleAdk integration (skipErrorChecking now set, since docs generation doesn't need the project to type-check). Pipeline updates for the plugin's v3 → v4 output format: - hidePageHeader added alongside hideBreadcrumbs; kind-prefixed titles ("Function: login()") cleaned when building frontmatter - new variables/ directory handled in link rewriting and nav - deprecation hoisting handles v4's "## Deprecated" heading sections, page-level warnings hoist to the top of the page, and inserts are MDX-safe after frontmatter - prose sanitizer escapes raw <, {, } that TypeDoc copies verbatim from third-party .d.ts comments (@google/adk ships a corrupted doc comment that 0.28 inherits onto WeaveAdkPlugin via its implements clause) Notable content changes: type-only class exports (Conversation, LLM, SubAgent, Tool, Turn, WeaveClient) are now correctly documented as interfaces since consumers can't construct them; the deprecated Session-era exports move from functions/ to variables/; deprecated symbols get strikethrough index entries. English nav in docs.json updated to match; localized navs are left to the locadex sync. Co-Authored-By: Claude Fable 5 --- docs.json | 26 +- .../weave/generate_typescript_sdk_docs.py | 134 ++- weave/reference/typescript-sdk.mdx | 118 +-- .../typescript-sdk/classes/conversation.mdx | 185 ---- .../typescript-sdk/classes/dataset.mdx | 176 ++-- .../typescript-sdk/classes/evaluation.mdx | 179 ++-- .../classes/evaluationlogger.mdx | 98 +- .../reference/typescript-sdk/classes/llm.mdx | 444 -------- .../typescript-sdk/classes/messagesprompt.mdx | 149 ++- .../typescript-sdk/classes/objectref.mdx | 121 +-- .../typescript-sdk/classes/scorelogger.mdx | 84 +- .../typescript-sdk/classes/stringprompt.mdx | 149 ++- .../typescript-sdk/classes/subagent.mdx | 204 ---- .../reference/typescript-sdk/classes/tool.mdx | 213 ---- .../reference/typescript-sdk/classes/turn.mdx | 304 ------ .../typescript-sdk/classes/weaveadkplugin.mdx | 610 +++++++---- .../typescript-sdk/classes/weaveclient.mdx | 955 ------------------ .../typescript-sdk/classes/weaveobject.mdx | 88 +- .../createopenaiagentstracingprocessor.mdx | 16 +- .../functions/createotelextension.mdx | 36 +- .../functions/endconversation.mdx | 26 +- .../typescript-sdk/functions/endllm.mdx | 28 +- .../typescript-sdk/functions/endsession.mdx | 28 - .../typescript-sdk/functions/endturn.mdx | 28 +- .../typescript-sdk/functions/flushotel.mdx | 14 +- .../functions/getcurrentconversation.mdx | 14 +- .../functions/getcurrentllm.mdx | 14 +- .../functions/getcurrentsession.mdx | 22 - .../functions/getcurrentturn.mdx | 14 +- .../typescript-sdk/functions/init.mdx | 34 +- .../functions/instrumentopenaiagents.mdx | 20 +- .../typescript-sdk/functions/login.mdx | 29 +- .../reference/typescript-sdk/functions/op.mdx | 138 +-- .../functions/patchrealtimesession.mdx | 16 +- .../requirecurrentcallstackentry.mdx | 14 +- .../functions/requirecurrentchildsummary.mdx | 14 +- .../typescript-sdk/functions/runisolated.mdx | 26 +- .../functions/startconversation.mdx | 28 +- .../typescript-sdk/functions/startllm.mdx | 28 +- .../typescript-sdk/functions/startsession.mdx | 28 - .../functions/startsubagent.mdx | 28 +- .../typescript-sdk/functions/starttool.mdx | 28 +- .../typescript-sdk/functions/startturn.mdx | 28 +- .../typescript-sdk/functions/weaveaudio.mdx | 28 +- .../typescript-sdk/functions/weaveimage.mdx | 28 +- .../functions/withattributes.mdx | 29 +- .../functions/wrapclaudeagentsdk.mdx | 32 +- .../functions/wrapgooglegenai.mdx | 24 +- .../typescript-sdk/functions/wrapopenai.mdx | 30 +- .../typescript-sdk/interfaces/callschema.mdx | 273 ++--- .../typescript-sdk/interfaces/callsfilter.mdx | 130 +-- .../interfaces/conversation.mdx | 145 +++ .../interfaces/conversationinit.mdx | 95 +- .../interfaces/getagentsoptions.mdx | 49 +- .../interfaces/getagentspansoptions.mdx | 70 +- .../interfaces/getagentturnoptions.mdx | 25 +- .../interfaces/getagentturnsoptions.mdx | 59 +- .../interfaces/getagentversionsoptions.mdx | 57 +- .../interfaces/getcallsoptions.mdx | 102 +- .../interfaces/httpresponse.mdx | 243 ++--- .../interfaces/httpvalidationerror.mdx | 18 +- .../typescript-sdk/interfaces/llm.mdx | 400 ++++++++ .../typescript-sdk/interfaces/llminit.mdx | 53 +- .../typescript-sdk/interfaces/message.mdx | 56 +- .../typescript-sdk/interfaces/query.mdx | 16 +- .../typescript-sdk/interfaces/reasoning.mdx | 12 +- .../typescript-sdk/interfaces/sortby.mdx | 27 +- .../typescript-sdk/interfaces/subagent.mdx | 183 ++++ .../interfaces/subagentinit.mdx | 86 +- .../typescript-sdk/interfaces/tool.mdx | 169 ++++ .../typescript-sdk/interfaces/toolinit.mdx | 53 +- .../typescript-sdk/interfaces/turn.mdx | 277 +++++ .../typescript-sdk/interfaces/turninit.mdx | 99 +- .../typescript-sdk/interfaces/usage.mdx | 58 +- .../typescript-sdk/interfaces/weaveaudio.mdx | 44 +- .../typescript-sdk/interfaces/weaveclient.mdx | 951 +++++++++++++++++ .../typescript-sdk/interfaces/weaveimage.mdx | 44 +- .../typescript-sdk/type-aliases/agent.mdx | 10 +- .../type-aliases/agentmessage.mdx | 10 +- .../typescript-sdk/type-aliases/agentspan.mdx | 10 +- .../typescript-sdk/type-aliases/agentturn.mdx | 10 +- .../type-aliases/agentversion.mdx | 10 +- .../type-aliases/getagentspansresult.mdx | 25 +- .../type-aliases/getagentsresult.mdx | 25 +- .../type-aliases/getagentturnresult.mdx | 12 +- .../type-aliases/getagentturnsresult.mdx | 70 +- .../type-aliases/getagentversionsresult.mdx | 25 +- .../type-aliases/messagepart.mdx | 10 +- .../typescript-sdk/type-aliases/modality.mdx | 10 +- .../typescript-sdk/type-aliases/op.mdx | 44 +- .../type-aliases/opdecorator.mdx | 18 +- .../typescript-sdk/type-aliases/response.mdx | 18 +- .../typescript-sdk/type-aliases/role.mdx | 12 +- .../typescript-sdk/type-aliases/session-1.mdx | 13 + .../typescript-sdk/type-aliases/session.mdx | 13 +- .../type-aliases/sessioninit.mdx | 9 +- .../typescript-sdk/type-aliases/settings.mdx | 78 +- .../typescript-sdk/variables/endsession.mdx | 37 + .../variables/getcurrentsession.mdx | 19 + .../typescript-sdk/variables/startsession.mdx | 45 + 100 files changed, 4358 insertions(+), 5076 deletions(-) delete mode 100644 weave/reference/typescript-sdk/classes/conversation.mdx delete mode 100644 weave/reference/typescript-sdk/classes/llm.mdx delete mode 100644 weave/reference/typescript-sdk/classes/subagent.mdx delete mode 100644 weave/reference/typescript-sdk/classes/tool.mdx delete mode 100644 weave/reference/typescript-sdk/classes/turn.mdx delete mode 100644 weave/reference/typescript-sdk/classes/weaveclient.mdx delete mode 100644 weave/reference/typescript-sdk/functions/endsession.mdx delete mode 100644 weave/reference/typescript-sdk/functions/getcurrentsession.mdx delete mode 100644 weave/reference/typescript-sdk/functions/startsession.mdx create mode 100644 weave/reference/typescript-sdk/interfaces/conversation.mdx create mode 100644 weave/reference/typescript-sdk/interfaces/llm.mdx create mode 100644 weave/reference/typescript-sdk/interfaces/subagent.mdx create mode 100644 weave/reference/typescript-sdk/interfaces/tool.mdx create mode 100644 weave/reference/typescript-sdk/interfaces/turn.mdx create mode 100644 weave/reference/typescript-sdk/interfaces/weaveclient.mdx create mode 100644 weave/reference/typescript-sdk/type-aliases/session-1.mdx create mode 100644 weave/reference/typescript-sdk/variables/endsession.mdx create mode 100644 weave/reference/typescript-sdk/variables/getcurrentsession.mdx create mode 100644 weave/reference/typescript-sdk/variables/startsession.mdx diff --git a/docs.json b/docs.json index 6604edcd21..ed71af9c11 100644 --- a/docs.json +++ b/docs.json @@ -1202,20 +1202,14 @@ { "group": "Classes", "pages": [ - "weave/reference/typescript-sdk/classes/conversation", "weave/reference/typescript-sdk/classes/dataset", "weave/reference/typescript-sdk/classes/evaluation", "weave/reference/typescript-sdk/classes/evaluationlogger", - "weave/reference/typescript-sdk/classes/llm", "weave/reference/typescript-sdk/classes/messagesprompt", "weave/reference/typescript-sdk/classes/objectref", "weave/reference/typescript-sdk/classes/scorelogger", "weave/reference/typescript-sdk/classes/stringprompt", - "weave/reference/typescript-sdk/classes/subagent", - "weave/reference/typescript-sdk/classes/tool", - "weave/reference/typescript-sdk/classes/turn", "weave/reference/typescript-sdk/classes/weaveadkplugin", - "weave/reference/typescript-sdk/classes/weaveclient", "weave/reference/typescript-sdk/classes/weaveobject" ] }, @@ -1226,12 +1220,10 @@ "weave/reference/typescript-sdk/functions/createotelextension", "weave/reference/typescript-sdk/functions/endconversation", "weave/reference/typescript-sdk/functions/endllm", - "weave/reference/typescript-sdk/functions/endsession", "weave/reference/typescript-sdk/functions/endturn", "weave/reference/typescript-sdk/functions/flushotel", "weave/reference/typescript-sdk/functions/getcurrentconversation", "weave/reference/typescript-sdk/functions/getcurrentllm", - "weave/reference/typescript-sdk/functions/getcurrentsession", "weave/reference/typescript-sdk/functions/getcurrentturn", "weave/reference/typescript-sdk/functions/instrumentopenaiagents", "weave/reference/typescript-sdk/functions/login", @@ -1242,7 +1234,6 @@ "weave/reference/typescript-sdk/functions/runisolated", "weave/reference/typescript-sdk/functions/startconversation", "weave/reference/typescript-sdk/functions/startllm", - "weave/reference/typescript-sdk/functions/startsession", "weave/reference/typescript-sdk/functions/startsubagent", "weave/reference/typescript-sdk/functions/starttool", "weave/reference/typescript-sdk/functions/startturn", @@ -1259,6 +1250,7 @@ "pages": [ "weave/reference/typescript-sdk/interfaces/callschema", "weave/reference/typescript-sdk/interfaces/callsfilter", + "weave/reference/typescript-sdk/interfaces/conversation", "weave/reference/typescript-sdk/interfaces/conversationinit", "weave/reference/typescript-sdk/interfaces/getagentsoptions", "weave/reference/typescript-sdk/interfaces/getagentspansoptions", @@ -1268,16 +1260,21 @@ "weave/reference/typescript-sdk/interfaces/getcallsoptions", "weave/reference/typescript-sdk/interfaces/httpresponse", "weave/reference/typescript-sdk/interfaces/httpvalidationerror", + "weave/reference/typescript-sdk/interfaces/llm", "weave/reference/typescript-sdk/interfaces/llminit", "weave/reference/typescript-sdk/interfaces/message", "weave/reference/typescript-sdk/interfaces/query", "weave/reference/typescript-sdk/interfaces/reasoning", "weave/reference/typescript-sdk/interfaces/sortby", + "weave/reference/typescript-sdk/interfaces/subagent", "weave/reference/typescript-sdk/interfaces/subagentinit", + "weave/reference/typescript-sdk/interfaces/tool", "weave/reference/typescript-sdk/interfaces/toolinit", + "weave/reference/typescript-sdk/interfaces/turn", "weave/reference/typescript-sdk/interfaces/turninit", "weave/reference/typescript-sdk/interfaces/usage", "weave/reference/typescript-sdk/interfaces/weaveaudio", + "weave/reference/typescript-sdk/interfaces/weaveclient", "weave/reference/typescript-sdk/interfaces/weaveimage" ] }, @@ -1301,9 +1298,18 @@ "weave/reference/typescript-sdk/type-aliases/response", "weave/reference/typescript-sdk/type-aliases/role", "weave/reference/typescript-sdk/type-aliases/session", + "weave/reference/typescript-sdk/type-aliases/session-1", "weave/reference/typescript-sdk/type-aliases/sessioninit", "weave/reference/typescript-sdk/type-aliases/settings" ] + }, + { + "group": "Variables", + "pages": [ + "weave/reference/typescript-sdk/variables/endsession", + "weave/reference/typescript-sdk/variables/getcurrentsession", + "weave/reference/typescript-sdk/variables/startsession" + ] } ] }, @@ -7597,4 +7603,4 @@ "stylesheet": "/css/styles.css" }, "theme": "aspen" -} \ No newline at end of file +} diff --git a/scripts/reference-generation/weave/generate_typescript_sdk_docs.py b/scripts/reference-generation/weave/generate_typescript_sdk_docs.py index a4573d24db..903ec155ba 100755 --- a/scripts/reference-generation/weave/generate_typescript_sdk_docs.py +++ b/scripts/reference-generation/weave/generate_typescript_sdk_docs.py @@ -124,8 +124,8 @@ def setup_typescript_project(weave_source): print(" Installing typedoc...") subprocess.run([ "npm", "install", "--save-dev", "--legacy-peer-deps", - "typedoc@0.25.13", - "typedoc-plugin-markdown@3.17.1" + "typedoc@0.28.20", + "typedoc-plugin-markdown@4.12.0" ], check=True) print(" ✓ Dependencies installed") @@ -154,7 +154,15 @@ def generate_typedoc(sdk_path, output_path): "excludeInternal": True, "disableSources": False, "cleanOutputDir": True, - "hideBreadcrumbs": True + "hideBreadcrumbs": True, + # The Weave repo currently ships a type error in the googleAdk + # integration (duplicate @google/genai versions in its dependency + # tree). Docs generation doesn't require the project to type-check, + # so don't let that abort the build. + "skipErrorChecking": True, + # typedoc-plugin-markdown v4 also prepends a bold package-name + # header to every page; Mintlify provides its own page chrome. + "hidePageHeader": True } config_path = sdk_path / "typedoc.json" @@ -175,6 +183,36 @@ def generate_typedoc(sdk_path, output_path): config_path.unlink() +def _escape_mdx_hostile_chars(content): + """Escape raw `<`, `{`, and `}` in prose so MDX doesn't parse them as JSX. + + TypeDoc escapes these in the output it generates itself, but comment text + inherited from third-party .d.ts files passes through verbatim (e.g. + @google/adk ships a corrupted doc comment containing raw code, which + TypeDoc 0.28 inherits onto WeaveAdkPlugin's members via its `implements` + clause). Fenced code blocks and inline code spans are left untouched; + already-escaped characters are not double-escaped. + """ + out_lines = [] + in_fence = False + for line in content.split('\n'): + if line.lstrip().startswith('```'): + in_fence = not in_fence + out_lines.append(line) + continue + if in_fence: + out_lines.append(line) + continue + # Even indices are prose; odd indices are inline code spans. + parts = re.split(r'(``[^`]*``|`[^`]*`)', line) + for i in range(0, len(parts), 2): + p = re.sub(r'(?) title_fixed = title.replace('\\<', '<').replace('\\>', '>') + # typedoc-plugin-markdown v4 wraps deprecated symbols' titles in + # strikethrough (`# ~~Variable: startSession~~`); the deprecation is + # surfaced via the hoisted callout instead. + title_fixed = title_fixed.replace('~~', '') + # Strip TypeDoc's reflection-kind prefix ("Class: LLM" → "LLM") so the # left nav shows bare symbol names; the nav group already conveys the kind. + # v4 writes "Type Alias"; v3 wrote "Type alias". title_fixed = re.sub( - r'^(?:Class|Interface|Function|Type alias|Enumeration|Namespace|Variable|Module):\s+', + r'^(?:Class|Interface|Function|Type [Aa]lias|Enumeration|Namespace|Variable|Module):\s+', '', title_fixed, ) + + # v4 suffixes function/method titles with call parens ("login()"); + # drop them to keep bare symbol names in the nav. + title_fixed = re.sub(r'\(\)$', '', title_fixed) + + # Escape MDX-hostile characters in the body before the frontmatter is + # prepended (the quoted YAML title must keep its bare < and >). + content = _escape_mdx_hostile_chars(content) # Add Mintlify frontmatter frontmatter = f"""--- @@ -256,15 +308,18 @@ def convert_to_mintlify_format(docs_dir): content = re.sub(r'\]\(\.\./interfaces/([^)#]+)(#[^)]+)?\)', lambda m: f'](../interfaces/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(\.\./functions/([^)#]+)(#[^)]+)?\)', lambda m: f'](../functions/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(\.\./type-aliases/([^)#]+)(#[^)]+)?\)', lambda m: f'](../type-aliases/{m.group(1).lower()}{m.group(2) or ""})', content) - + content = re.sub(r'\]\(\.\./variables/([^)#]+)(#[^)]+)?\)', lambda m: f'](../variables/{m.group(1).lower()}{m.group(2) or ""})', content) + # 4. Fix relative links without ../ prefix (same directory or subdirectory) content = re.sub(r'\]\(classes/([^)#]+)(#[^)]+)?\)', lambda m: f'](../classes/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(interfaces/([^)#]+)(#[^)]+)?\)', lambda m: f'](../interfaces/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(functions/([^)#]+)(#[^)]+)?\)', lambda m: f'](../functions/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(type-aliases/([^)#]+)(#[^)]+)?\)', lambda m: f'](../type-aliases/{m.group(1).lower()}{m.group(2) or ""})', content) - + content = re.sub(r'\]\(variables/([^)#]+)(#[^)]+)?\)', lambda m: f'](../variables/{m.group(1).lower()}{m.group(2) or ""})', content) + # 5. Fix same-directory class/interface links (start with capital letter, no path separator) - content = re.sub(r'\]\(([A-Z][a-zA-Z]+)(#[^)]+)?\)', lambda m: f'](./{m.group(1).lower()}{m.group(2) or ""})', content) + # Allow digits and hyphens for TypeDoc's name-collision suffixes (e.g. Session-1) + content = re.sub(r'\]\(([A-Z][a-zA-Z0-9-]+)(#[^)]+)?\)', lambda m: f'](./{m.group(1).lower()}{m.group(2) or ""})', content) # 6. Special fix for README/landing page - it becomes typescript-sdk.mdx at parent level if md_file.name == 'README.md': @@ -274,7 +329,8 @@ def convert_to_mintlify_format(docs_dir): content = re.sub(r'\]\(\.\./interfaces/([^)#]+)(#[^)]+)?\)', lambda m: f'](./typescript-sdk/interfaces/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(\.\./functions/([^)#]+)(#[^)]+)?\)', lambda m: f'](./typescript-sdk/functions/{m.group(1).lower()}{m.group(2) or ""})', content) content = re.sub(r'\]\(\.\./type-aliases/([^)#]+)(#[^)]+)?\)', lambda m: f'](./typescript-sdk/type-aliases/{m.group(1).lower()}{m.group(2) or ""})', content) - + content = re.sub(r'\]\(\.\./variables/([^)#]+)(#[^)]+)?\)', lambda m: f'](./typescript-sdk/variables/{m.group(1).lower()}{m.group(2) or ""})', content) + # Fix self-referential anchor links like (README#anchor) that appear in Table of Contents # We'll scan the content to determine if each anchor refers to a function or type alias # First, extract all type alias names (they have the Ƭ symbol) @@ -638,23 +694,34 @@ def organize_for_mintlify(temp_output, final_output): print(" ✓ Documentation organized") -# Matches TypeDoc's @deprecated output: -# `Deprecated` +# Matches TypeDoc's @deprecated output. typedoc-plugin-markdown v4 renders it +# as a heading section whose level depends on nesting depth (`## Deprecated` +# at page level, `#### Deprecated` under a member, `##### Deprecated` under an +# accessor signature): +# ## Deprecated # # # -# Stops at the next heading or `___` separator (or end of file). The non-greedy -# `.+?` plus the lookahead lets the message itself span multiple soft-wrapped -# lines without swallowing the section that follows it. +# (v3 rendered an inline `` `Deprecated` `` label instead; that form is also +# still matched.) Stops at the next heading or `***`/`___` separator (or end +# of file). The non-greedy `.+?` plus the lookahead lets the message itself +# span multiple soft-wrapped lines without swallowing the section that +# follows it. _DEPRECATED_BLOCK_RE = re.compile( - r'\n\n`Deprecated`\n\n(.+?)(?=\n\n(?:#{1,6} |___|\Z))', + r'\n\n(?:(#{2,5}) Deprecated|`Deprecated`)\n\n(.+?)(?=\n\n(?:#{1,6} |\*\*\*|___)|\n*\Z)', re.DOTALL, ) # Symbol-level headings only. H4 (`#### Returns`, `#### Defined in`) is a # *sub*section of a symbol and is deliberately excluded — anchoring the -# warning there would put it back where TypeDoc already placed it. -_SYMBOL_HEADING_RE = re.compile(r'^#{1,3} .+$', re.MULTILINE) +# warning there would put it back where TypeDoc already placed it. The +# `Deprecated` headings themselves are excluded too: they belong to the very +# blocks being removed, so anchoring a later warning to one would insert +# text into a deleted span. +_SYMBOL_HEADING_RE = re.compile(r'^#{1,3} (?!Deprecated$).+$', re.MULTILINE) + +# Frontmatter block at the very start of a converted .mdx file. +_FRONTMATTER_RE = re.compile(r'\A---\n.*?\n---\n', re.DOTALL) def hoist_deprecation_callouts(docs_root): @@ -691,21 +758,42 @@ def _hoist_deprecations_in_text(content): headings = list(_SYMBOL_HEADING_RE.finditer(content)) + # A page-level deprecation can precede every heading (the H1 was already + # moved into frontmatter during conversion), so the fallback anchor must + # sit after the frontmatter, never at position 0. + fm = _FRONTMATTER_RE.match(content) + default_anchor = fm.end() if fm else 0 + edits = [] inserts_by_pos = {} for dep in deprecations: - message = dep.group(1).strip() + message = dep.group(2).strip() warning = f'\n\n\n **Deprecated.** {message}\n' - anchor = 0 - for h in headings: - if h.start() < dep.start(): - anchor = h.end() - else: - break + # An `## Deprecated` (H2) section deprecates the page's own symbol — + # its H1 heading is already gone (moved into frontmatter), and any H2 + # headings preceding it (`## Parameters`, `## Examples`, ...) are + # sections of the same symbol, not other symbols. Hoist it to the top + # of the page. Deeper levels (H4/H5) belong to a member documented + # under an H2/H3 heading, so those anchor to the nearest one. + if dep.group(1) == '##': + anchor = default_anchor + else: + anchor = default_anchor + for h in headings: + if h.start() < dep.start(): + anchor = h.end() + else: + break edits.append((dep.start(), dep.end(), '')) + # Heading-anchored inserts land before the blank line that already + # follows the heading; a top-of-page insert lands right before the + # first content line, so it needs its own trailing blank line to + # keep the following markdown block separate from the JSX element. + if anchor == default_anchor: + warning += '\n' inserts_by_pos.setdefault(anchor, []).append(warning) for pos, warns in inserts_by_pos.items(): diff --git a/weave/reference/typescript-sdk.mdx b/weave/reference/typescript-sdk.mdx index ca5a142b99..806d5286cf 100644 --- a/weave/reference/typescript-sdk.mdx +++ b/weave/reference/typescript-sdk.mdx @@ -3,91 +3,88 @@ title: "weave" description: "TypeScript SDK reference" --- -## Table of contents +## Classes -### Classes - -- [Conversation](./typescript-sdk/classes/conversation) - [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) - [StringPrompt](./typescript-sdk/classes/stringprompt) -- [SubAgent](./typescript-sdk/classes/subagent) -- [Tool](./typescript-sdk/classes/tool) -- [Turn](./typescript-sdk/classes/turn) - [WeaveAdkPlugin](./typescript-sdk/classes/weaveadkplugin) -- [WeaveClient](./typescript-sdk/classes/weaveclient) - [WeaveObject](./typescript-sdk/classes/weaveobject) -### Interfaces +## Interfaces - [CallSchema](./typescript-sdk/interfaces/callschema) - [CallsFilter](./typescript-sdk/interfaces/callsfilter) +- [Conversation](./typescript-sdk/interfaces/conversation) - [ConversationInit](./typescript-sdk/interfaces/conversationinit) +- [GetAgentsOptions](./typescript-sdk/interfaces/getagentsoptions) - [GetAgentSpansOptions](./typescript-sdk/interfaces/getagentspansoptions) - [GetAgentTurnOptions](./typescript-sdk/interfaces/getagentturnoptions) - [GetAgentTurnsOptions](./typescript-sdk/interfaces/getagentturnsoptions) - [GetAgentVersionsOptions](./typescript-sdk/interfaces/getagentversionsoptions) -- [GetAgentsOptions](./typescript-sdk/interfaces/getagentsoptions) - [GetCallsOptions](./typescript-sdk/interfaces/getcallsoptions) -- [HTTPValidationError](./typescript-sdk/interfaces/httpvalidationerror) - [HttpResponse](./typescript-sdk/interfaces/httpresponse) +- [HTTPValidationError](./typescript-sdk/interfaces/httpvalidationerror) +- [LLM](./typescript-sdk/interfaces/llm) - [LLMInit](./typescript-sdk/interfaces/llminit) - [Message](./typescript-sdk/interfaces/message) - [Query](./typescript-sdk/interfaces/query) - [Reasoning](./typescript-sdk/interfaces/reasoning) - [SortBy](./typescript-sdk/interfaces/sortby) +- [SubAgent](./typescript-sdk/interfaces/subagent) - [SubAgentInit](./typescript-sdk/interfaces/subagentinit) +- [Tool](./typescript-sdk/interfaces/tool) - [ToolInit](./typescript-sdk/interfaces/toolinit) +- [Turn](./typescript-sdk/interfaces/turn) - [TurnInit](./typescript-sdk/interfaces/turninit) - [Usage](./typescript-sdk/interfaces/usage) - [WeaveAudio](./typescript-sdk/interfaces/weaveaudio) +- [WeaveClient](./typescript-sdk/interfaces/weaveclient) - [WeaveImage](./typescript-sdk/interfaces/weaveimage) +## Type Aliases -### Type Aliases - +- [Agent](./typescript-sdk/type-aliases/agent) - [AgentMessage](./typescript-sdk/type-aliases/agentmessage) - [AgentSpan](./typescript-sdk/type-aliases/agentspan) - [AgentTurn](./typescript-sdk/type-aliases/agentturn) - [AgentVersion](./typescript-sdk/type-aliases/agentversion) -- [Agent](./typescript-sdk/type-aliases/agent) - [GetAgentSpansResult](./typescript-sdk/type-aliases/getagentspansresult) +- [GetAgentsResult](./typescript-sdk/type-aliases/getagentsresult) - [GetAgentTurnResult](./typescript-sdk/type-aliases/getagentturnresult) - [GetAgentTurnsResult](./typescript-sdk/type-aliases/getagentturnsresult) - [GetAgentVersionsResult](./typescript-sdk/type-aliases/getagentversionsresult) -- [GetAgentsResult](./typescript-sdk/type-aliases/getagentsresult) - [MessagePart](./typescript-sdk/type-aliases/messagepart) - [Modality](./typescript-sdk/type-aliases/modality) -- [OpDecorator](./typescript-sdk/type-aliases/opdecorator) - [Op](./typescript-sdk/type-aliases/op) +- [OpDecorator](./typescript-sdk/type-aliases/opdecorator) - [Response](./typescript-sdk/type-aliases/response) - [Role](./typescript-sdk/type-aliases/role) -- [SessionInit](./typescript-sdk/type-aliases/sessioninit) -- [Session](./typescript-sdk/type-aliases/session) +- [~~Session~~](./typescript-sdk/type-aliases/session) +- [~~Session~~](./typescript-sdk/type-aliases/session-1) +- [~~SessionInit~~](./typescript-sdk/type-aliases/sessioninit) - [Settings](./typescript-sdk/type-aliases/settings) -### Variables +## Variables -- [Session](#session) +- [~~endSession~~](./typescript-sdk/variables/endsession) +- [~~getCurrentSession~~](./typescript-sdk/variables/getcurrentsession) +- [~~startSession~~](./typescript-sdk/variables/startsession) - -### Functions +## Functions - [createOpenAIAgentsTracingProcessor](./typescript-sdk/functions/createopenaiagentstracingprocessor) - [createOtelExtension](./typescript-sdk/functions/createotelextension) - [endConversation](./typescript-sdk/functions/endconversation) - [endLLM](./typescript-sdk/functions/endllm) -- [endSession](./typescript-sdk/functions/endsession) - [endTurn](./typescript-sdk/functions/endturn) - [flushOTel](./typescript-sdk/functions/flushotel) - [getCurrentConversation](./typescript-sdk/functions/getcurrentconversation) - [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) @@ -99,7 +96,6 @@ description: "TypeScript SDK reference" - [runIsolated](./typescript-sdk/functions/runisolated) - [startConversation](./typescript-sdk/functions/startconversation) - [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) @@ -108,72 +104,4 @@ description: "TypeScript SDK reference" - [withAttributes](./typescript-sdk/functions/withattributes) - [wrapClaudeAgentSdk](./typescript-sdk/functions/wrapclaudeagentsdk) - [wrapGoogleGenAI](./typescript-sdk/functions/wrapgooglegenai) -- [wrapOpenAI](./typescript-sdk/functions/wrapopenai) - -## Type Aliases - - - - - - - - - - - - - - - - - - - - -### Session - - - **Deprecated.** Use [Conversation](./typescript-sdk/classes/conversation) instead. - - -• **Session**: typeof [`Conversation`](./typescript-sdk/classes/conversation) - -#### Defined in - -[src/genai/conversation.ts:191](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L191) - -[src/genai/conversation.ts:193](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L193) - -## Functions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- [wrapOpenAI](./typescript-sdk/functions/wrapopenai) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/conversation.mdx b/weave/reference/typescript-sdk/classes/conversation.mdx deleted file mode 100644 index ca99b1bc9d..0000000000 --- a/weave/reference/typescript-sdk/classes/conversation.mdx +++ /dev/null @@ -1,185 +0,0 @@ ---- -title: "Conversation" -description: "TypeScript SDK reference" ---- - -A Conversation 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 - -### Accessors - -- [agentName](./conversation#agentname) -- [attributes](./conversation#attributes) -- [conversationId](./conversation#conversationid) -- [model](./conversation#model) -- [sessionId](./conversation#sessionid) - -### Methods - -- [end](./conversation#end) -- [startTurn](./conversation#startturn) -- [create](./conversation#create) - -## Accessors - -### agentName - -• `get` **agentName**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/conversation.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L94) - -___ - -### attributes - -• `get` **attributes**(): `Attributes` - -#### Returns - -`Attributes` - -#### Defined in - -[src/genai/conversation.ts:106](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L106) - -___ - -### conversationId - -• `get` **conversationId**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/conversation.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L102) - -___ - -### model - -• `get` **model**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/conversation.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L98) - -___ - -### sessionId - - - **Deprecated.** Use [Conversation.conversationId](./conversation#conversationid) instead. - - -• `get` **sessionId**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/conversation.ts:111](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L111) - -## Methods - -### end - -▸ **end**(`opts?`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | - -#### Returns - -`void` - -#### Defined in - -[src/genai/conversation.ts:168](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L168) - -___ - -### startTurn - -▸ **startTurn**(`opts?`): [`Turn`](./turn) - -Start a new `Turn` under this `Conversation`. The turn inherits the -conversation's `conversationId`; `agentName`, `agentId`, `agentDescription`, -`agentVersion` and `model` fall back to the conversation's values when not -provided on `opts`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`TurnInit`](../interfaces/turninit) | - -#### Returns - -[`Turn`](./turn) - -`Example` - -```ts twoslash -// @noErrors -const turn = conversation.startTurn(); -``` - -`Example` - -```ts twoslash -// @noErrors -const turn = conversation.startTurn({ - model: 'gpt-4o', - agentName: 'research-bot', - agentId: 'research-bot-prod', - agentDescription: 'Looks up facts on Wikipedia.', - agentVersion: '1.4.2', - userMessage: 'What is the weather in Tokyo?', - systemInstructions: ['You are a helpful weather bot.'], - startTime: new Date('2026-05-29T10:00:00.000Z'), -}); -``` - -#### Defined in - -[src/genai/conversation.ts:156](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L156) - -___ - -### create - -▸ **create**(`opts?`): [`Conversation`](./conversation) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`ConversationInit`](../interfaces/conversationinit) | - -#### Returns - -[`Conversation`](./conversation) - -#### Defined in - -[src/genai/conversation.ts:115](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L115) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/dataset.mdx b/weave/reference/typescript-sdk/classes/dataset.mdx index ab744e8080..8bf7aa29b3 100644 --- a/weave/reference/typescript-sdk/classes/dataset.mdx +++ b/weave/reference/typescript-sdk/classes/dataset.mdx @@ -3,9 +3,11 @@ title: "Dataset" description: "TypeScript SDK reference" --- +Defined in: [src/dataset.ts:52](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L52) + Dataset object with easy saving and automatic versioning -`Example` +## Example ```ts twoslash // @noErrors @@ -26,208 +28,162 @@ const exampleLabel = dataset.getRow(2).sentence; const ref = await dataset.save() ``` -## Type parameters - -| Name | Type | -| :------ | :------ | -| `R` | extends `DatasetRow` | - -## Hierarchy +## Extends - [`WeaveObject`](./weaveobject) - ↳ `Dataset` - -## Table of contents - -### Constructors - -- [constructor](./dataset#constructor) - -### Properties - -- [\_\_savedRef](./dataset#__savedref) -- [rows](./dataset#rows) - -### Accessors - -- [description](./dataset#description) -- [length](./dataset#length) -- [name](./dataset#name) +## Type Parameters -### Methods +### R -- [[asyncIterator]](./dataset#[asynciterator]) -- [getRow](./dataset#getrow) -- [save](./dataset#save) -- [saveAttrs](./dataset#saveattrs) +`R` *extends* `DatasetRow` ## Constructors -### constructor +### Constructor -• **new Dataset**\<`R`\>(`parameters`): [`Dataset`](./dataset)\<`R`\> +> **new Dataset**\<`R`\>(`parameters`): `Dataset`\<`R`\> -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `R` | extends `DatasetRow` | +Defined in: [src/dataset.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L55) #### Parameters -| Name | Type | -| :------ | :------ | -| `parameters` | `DatasetParameters`\<`R`\> | +##### parameters + +`DatasetParameters`\<`R`\> #### Returns -[`Dataset`](./dataset)\<`R`\> +`Dataset`\<`R`\> #### Overrides -[WeaveObject](./weaveobject).[constructor](./weaveobject#constructor) - -#### Defined in - -[src/dataset.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L55) +[`WeaveObject`](./weaveobject).[`constructor`](./weaveobject#constructor) ## Properties -### \_\_savedRef +### \_\_savedRef? -• `Optional` **\_\_savedRef**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> +> `optional` **\_\_savedRef?**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> -#### Inherited from +Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) -[WeaveObject](./weaveobject).[__savedRef](./weaveobject#__savedref) - -#### Defined in +#### Inherited from -[src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) +[`WeaveObject`](./weaveobject).[`__savedRef`](./weaveobject#__savedref) -___ +*** ### rows -• **rows**: `Table`\<`R`\> +> **rows**: `Table`\<`R`\> -#### Defined in - -[src/dataset.ts:53](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L53) +Defined in: [src/dataset.ts:53](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L53) ## Accessors ### description -• `get` **description**(): `undefined` \| `string` +#### Get Signature -#### Returns +> **get** **description**(): `string` \| `undefined` -`undefined` \| `string` +Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) -#### Inherited from +##### Returns -WeaveObject.description +`string` \| `undefined` -#### Defined in +#### Inherited from -[src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) +[`WeaveObject`](./weaveobject).[`description`](./weaveobject#description) -___ +*** ### length -• `get` **length**(): `number` +#### Get Signature -#### Returns +> **get** **length**(): `number` -`number` +Defined in: [src/dataset.ts:68](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L68) -#### Defined in +##### Returns -[src/dataset.ts:68](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L68) +`number` -___ +*** ### name -• `get` **name**(): `string` +#### Get Signature -#### Returns +> **get** **name**(): `string` -`string` +Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) -#### Inherited from +##### Returns -WeaveObject.name +`string` -#### Defined in +#### Inherited from -[src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) +[`WeaveObject`](./weaveobject).[`name`](./weaveobject#name) ## Methods -### [asyncIterator] +### \[asyncIterator\]() -▸ **[asyncIterator]**(): `AsyncIterator`\<`any`, `any`, `any`\> +> **\[asyncIterator\]**(): `AsyncIterator`\<`any`\> -#### Returns +Defined in: [src/dataset.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L72) -`AsyncIterator`\<`any`, `any`, `any`\> +#### Returns -#### Defined in +`AsyncIterator`\<`any`\> -[src/dataset.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L72) +*** -___ +### getRow() -### getRow +> **getRow**(`index`): `R` -▸ **getRow**(`index`): `R` +Defined in: [src/dataset.ts:78](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L78) #### Parameters -| Name | Type | -| :------ | :------ | -| `index` | `number` | +##### index + +`number` #### Returns `R` -#### Defined in +*** -[src/dataset.ts:78](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L78) +### save() -___ +> **save**(): `Promise`\<[`ObjectRef`](./objectref)\> -### save - -▸ **save**(): `Promise`\<[`ObjectRef`](./objectref)\> +Defined in: [src/dataset.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L64) #### Returns `Promise`\<[`ObjectRef`](./objectref)\> -#### Defined in - -[src/dataset.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L64) +*** -___ +### saveAttrs() -### saveAttrs +> **saveAttrs**(): `object` -▸ **saveAttrs**(): `Object` +Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) #### Returns -`Object` +`object` #### Inherited from -[WeaveObject](./weaveobject).[saveAttrs](./weaveobject#saveattrs) - -#### Defined in - -[src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) \ No newline at end of file +[`WeaveObject`](./weaveobject).[`saveAttrs`](./weaveobject#saveattrs) \ 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 6e3769f7f3..1f9e5a2348 100644 --- a/weave/reference/typescript-sdk/classes/evaluation.mdx +++ b/weave/reference/typescript-sdk/classes/evaluation.mdx @@ -3,6 +3,8 @@ title: "Evaluation" description: "TypeScript SDK reference" --- +Defined in: [src/evaluation.ts:139](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L139) + Sets up an evaluation which includes a set of scorers and a dataset. Calling evaluation.evaluate(model) will pass in rows form a dataset into a model matching @@ -10,7 +12,7 @@ the names of the columns of the dataset to the argument names in model.predict. Then it will call all of the scorers and save the results in weave. -`Example` +## Example ```ts twoslash // @noErrors @@ -44,183 +46,162 @@ const evaluation = new weave.Evaluation({ const results = await evaluation.evaluate({ model }); ``` -## Type parameters - -| Name | Type | -| :------ | :------ | -| `R` | extends `DatasetRow` | -| `E` | extends `DatasetRow` | -| `M` | `M` | - -## Hierarchy +## Extends - [`WeaveObject`](./weaveobject) - ↳ `Evaluation` - -## Table of contents - -### Constructors +## Type Parameters -- [constructor](./evaluation#constructor) +### R -### Properties +`R` *extends* `DatasetRow` -- [\_\_savedRef](./evaluation#__savedref) +### E -### Accessors +`E` *extends* `DatasetRow` -- [description](./evaluation#description) -- [name](./evaluation#name) +### M -### Methods - -- [evaluate](./evaluation#evaluate) -- [predictAndScore](./evaluation#predictandscore) -- [saveAttrs](./evaluation#saveattrs) +`M` ## Constructors -### constructor - -• **new Evaluation**\<`R`, `E`, `M`\>(`parameters`): [`Evaluation`](./evaluation)\<`R`, `E`, `M`\> +### Constructor -#### Type parameters +> **new Evaluation**\<`R`, `E`, `M`\>(`parameters`): `Evaluation`\<`R`, `E`, `M`\> -| Name | Type | -| :------ | :------ | -| `R` | extends `DatasetRow` | -| `E` | extends `DatasetRow` | -| `M` | `M` | +Defined in: [src/evaluation.ts:150](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L150) #### Parameters -| Name | Type | -| :------ | :------ | -| `parameters` | `EvaluationParameters`\<`R`, `E`, `M`\> | +##### parameters + +`EvaluationParameters`\<`R`, `E`, `M`\> #### Returns -[`Evaluation`](./evaluation)\<`R`, `E`, `M`\> +`Evaluation`\<`R`, `E`, `M`\> #### Overrides -[WeaveObject](./weaveobject).[constructor](./weaveobject#constructor) - -#### Defined in - -[src/evaluation.ts:150](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L150) +[`WeaveObject`](./weaveobject).[`constructor`](./weaveobject#constructor) ## Properties -### \_\_savedRef +### \_\_savedRef? -• `Optional` **\_\_savedRef**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> +> `optional` **\_\_savedRef?**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> -#### Inherited from - -[WeaveObject](./weaveobject).[__savedRef](./weaveobject#__savedref) +Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) -#### Defined in +#### Inherited from -[src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) +[`WeaveObject`](./weaveobject).[`__savedRef`](./weaveobject#__savedref) ## Accessors ### description -• `get` **description**(): `undefined` \| `string` +#### Get Signature -#### Returns +> **get** **description**(): `string` \| `undefined` -`undefined` \| `string` +Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) -#### Inherited from +##### Returns -WeaveObject.description +`string` \| `undefined` -#### Defined in +#### Inherited from -[src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) +[`WeaveObject`](./weaveobject).[`description`](./weaveobject#description) -___ +*** ### name -• `get` **name**(): `string` +#### Get Signature -#### Returns +> **get** **name**(): `string` -`string` +Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) -#### Inherited from +##### Returns -WeaveObject.name +`string` -#### Defined in +#### Inherited from -[src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) +[`WeaveObject`](./weaveobject).[`name`](./weaveobject#name) ## Methods -### evaluate +### evaluate() + +> **evaluate**(`__namedParameters`): `Promise`\<`Record`\<`string`, `any`\>\> -▸ **evaluate**(`«destructured»`): `Promise`\<`Record`\<`string`, `any`\>\> +Defined in: [src/evaluation.ts:165](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L165) #### Parameters -| Name | Type | Default value | -| :------ | :------ | :------ | -| `«destructured»` | `Object` | `undefined` | -| › `maxConcurrency?` | `number` | `5` | -| › `model` | `WeaveCallable`\<(...`args`: [\{ `datasetRow`: `R` }]) => `Promise`\<`M`\>\> | `undefined` | -| › `nTrials?` | `number` | `1` | +##### \_\_namedParameters + +###### maxConcurrency? + +`number` = `5` + +###### model + +`WeaveCallable`\<(...`args`) => `Promise`\<`M`\>\> + +###### nTrials? + +`number` = `1` #### Returns `Promise`\<`Record`\<`string`, `any`\>\> -#### Defined in - -[src/evaluation.ts:165](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L165) +*** -___ +### predictAndScore() -### predictAndScore +> **predictAndScore**(`__namedParameters`): `Promise`\<\{ `model_latency`: `number`; `model_output`: `any`; `model_success`: `boolean`; `scores`: \{\[`key`: `string`\]: `any`; \}; \}\> -▸ **predictAndScore**(`«destructured»`): `Promise`\<\{ `model_latency`: `number` = modelLatency; `model_output`: `any` = modelOutput; `model_success`: `boolean` = !modelError; `scores`: \{ `[key: string]`: `any`; } }\> +Defined in: [src/evaluation.ts:244](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L244) #### Parameters -| Name | Type | -| :------ | :------ | -| `«destructured»` | `Object` | -| › `columnMapping?` | `ColumnMapping`\<`R`, `E`\> | -| › `example` | `R` | -| › `model` | `WeaveCallable`\<(...`args`: [\{ `datasetRow`: `E` }]) => `Promise`\<`M`\>\> | +##### \_\_namedParameters -#### Returns - -`Promise`\<\{ `model_latency`: `number` = modelLatency; `model_output`: `any` = modelOutput; `model_success`: `boolean` = !modelError; `scores`: \{ `[key: string]`: `any`; } }\> +###### columnMapping? -#### Defined in +`ColumnMapping`\<`R`, `E`\> -[src/evaluation.ts:244](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L244) +###### example -___ +`R` -### saveAttrs +###### model -▸ **saveAttrs**(): `Object` +`WeaveCallable`\<(...`args`) => `Promise`\<`M`\>\> #### Returns -`Object` +`Promise`\<\{ `model_latency`: `number`; `model_output`: `any`; `model_success`: `boolean`; `scores`: \{\[`key`: `string`\]: `any`; \}; \}\> -#### Inherited from +*** + +### saveAttrs() + +> **saveAttrs**(): `object` -[WeaveObject](./weaveobject).[saveAttrs](./weaveobject#saveattrs) +Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) -#### Defined in +#### Returns + +`object` + +#### Inherited from -[src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) \ No newline at end of file +[`WeaveObject`](./weaveobject).[`saveAttrs`](./weaveobject#saveattrs) \ 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 e950356283..1dd9a53555 100644 --- a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx +++ b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx @@ -3,12 +3,14 @@ title: "EvaluationLogger" description: "TypeScript SDK reference" --- +Defined in: [src/evaluationLogger.ts:554](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L554) + EvaluationLogger enables incremental logging of predictions and scores. Unlike the traditional Evaluation class which requires upfront dataset and batch processing, EvaluationLogger allows you to log predictions as they happen, with flexible scoring. -`Example` +## Example ```ts twoslash // @noErrors @@ -27,43 +29,31 @@ for (const example of streamingData) { await ev.logSummary(); ``` -## Table of contents - -### Constructors - -- [constructor](./evaluationlogger#constructor) - -### Methods - -- [logPrediction](./evaluationlogger#logprediction) -- [logPredictionAsync](./evaluationlogger#logpredictionasync) -- [logSummary](./evaluationlogger#logsummary) - ## Constructors -### constructor +### Constructor -• **new EvaluationLogger**(`options`): [`EvaluationLogger`](./evaluationlogger) +> **new EvaluationLogger**(`options`): `EvaluationLogger` -#### Parameters +Defined in: [src/evaluationLogger.ts:573](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L573) -| Name | Type | -| :------ | :------ | -| `options` | `EvaluationLoggerOptions` | +#### Parameters -#### Returns +##### options -[`EvaluationLogger`](./evaluationlogger) +`EvaluationLoggerOptions` -#### Defined in +#### Returns -[src/evaluationLogger.ts:573](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L573) +`EvaluationLogger` ## Methods -### logPrediction +### logPrediction() + +> **logPrediction**(`inputs`, `output`): [`ScoreLogger`](./scorelogger) -▸ **logPrediction**(`inputs`, `output`): [`ScoreLogger`](./scorelogger) +Defined in: [src/evaluationLogger.ts:660](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L660) Log a prediction with its input and output (synchronous version). Creates a predict_and_score call (with child predict call). @@ -74,16 +64,19 @@ ScoreLogger (logScore, finish) will be queued and executed when initialization c #### Parameters -| Name | Type | -| :------ | :------ | -| `inputs` | `Record`\<`string`, `any`\> | -| `output` | `any` | +##### inputs + +`Record`\<`string`, `any`\> + +##### output + +`any` #### Returns [`ScoreLogger`](./scorelogger) -`Example` +#### Example ```ts twoslash // @noErrors @@ -94,15 +87,13 @@ scoreLogger.finish(); await evalLogger.logSummary(); // Waits for everything ``` -#### Defined in +*** -[src/evaluationLogger.ts:660](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L660) +### logPredictionAsync() -___ +> **logPredictionAsync**(`inputs`, `output`): `Promise`\<[`ScoreLogger`](./scorelogger)\> -### logPredictionAsync - -▸ **logPredictionAsync**(`inputs`, `output`): `Promise`\<[`ScoreLogger`](./scorelogger)\> +Defined in: [src/evaluationLogger.ts:685](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L685) Log a prediction with its input and output (async version). Like logPrediction() but returns a Promise that resolves when @@ -112,16 +103,19 @@ Use this if you need to await the initialization before proceeding. #### Parameters -| Name | Type | -| :------ | :------ | -| `inputs` | `Record`\<`string`, `any`\> | -| `output` | `any` | +##### inputs + +`Record`\<`string`, `any`\> + +##### output + +`any` #### Returns `Promise`\<[`ScoreLogger`](./scorelogger)\> -`Example` +#### Example ```ts twoslash // @noErrors @@ -131,15 +125,13 @@ await scoreLogger.logScore('accuracy', 0.95); await scoreLogger.finish(); ``` -#### Defined in - -[src/evaluationLogger.ts:685](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L685) +*** -___ +### logSummary() -### logSummary +> **logSummary**(`summary?`): `Promise`\<`void`\> -▸ **logSummary**(`summary?`): `Promise`\<`void`\> +Defined in: [src/evaluationLogger.ts:786](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L786) Log a summary and finalize the evaluation. Creates a summarize call and finishes the evaluate call. @@ -149,14 +141,10 @@ it will wait for all pending operations to complete. #### Parameters -| Name | Type | -| :------ | :------ | -| `summary?` | `Record`\<`string`, `any`\> | +##### summary? -#### Returns +`Record`\<`string`, `any`\> -`Promise`\<`void`\> - -#### Defined in +#### Returns -[src/evaluationLogger.ts:786](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L786) \ No newline at end of file +`Promise`\<`void`\> \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/llm.mdx b/weave/reference/typescript-sdk/classes/llm.mdx deleted file mode 100644 index 5e052d71dc..0000000000 --- a/weave/reference/typescript-sdk/classes/llm.mdx +++ /dev/null @@ -1,444 +0,0 @@ ---- -title: "LLM" -description: "TypeScript SDK reference" ---- - -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 twoslash -// @noErrors -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(); -} -``` - -`Example` - -```ts twoslash -// @noErrors -const llm = weave.startLLM({ - model: 'gpt-4o-mini', - providerName: 'openai', - systemInstructions: ['You are a helpful weather bot.'], - startTime: new Date('2026-05-29T10:00:00.000Z'), -}); - -try { - // ... call the LLM, populate llm.outputMessages / usage ... -} finally { - llm.end(); -} -``` - -## Hierarchy - -- `SpanBase` - - ↳ `LLM` - -## Table of contents - -### Properties - -- [inputMessages](./llm#inputmessages) -- [model](./llm#model) -- [outputMessages](./llm#outputmessages) -- [providerName](./llm#providername) -- [reasoning](./llm#reasoning) -- [usage](./llm#usage) - -### Methods - -- [addEvent](./llm#addevent) -- [attachMedia](./llm#attachmedia) -- [attachMediaUrl](./llm#attachmediaurl) -- [end](./llm#end) -- [output](./llm#output) -- [record](./llm#record) -- [setAttributes](./llm#setattributes) -- [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 - -[src/genai/llm.ts:93](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L93) - -___ - -### model - -• `Readonly` **model**: `string` - -#### Defined in - -[src/genai/llm.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L117) - -___ - -### outputMessages - -• **outputMessages**: [`Message`](../interfaces/message)[] = `[]` - -Assistant messages returned by the model. Flushed to -`gen_ai.output.messages` on `end()`. - -#### Defined in - -[src/genai/llm.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L98) - -___ - -### providerName - -• `Readonly` **providerName**: `string` - -#### Defined in - -[src/genai/llm.ts:118](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L118) - -___ - -### reasoning - -• `Optional` **reasoning**: [`Reasoning`](../interfaces/reasoning) - -Chain-of-thought content. Folded into the last assistant message as a -ReasoningPart at serialization time. - -#### Defined in - -[src/genai/llm.ts:105](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L105) - -___ - -### usage - -• **usage**: [`Usage`](../interfaces/usage) = `{}` - -Token counts and cache stats. Flushed to `gen_ai.usage.*` on `end()`. - -#### Defined in - -[src/genai/llm.ts:100](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L100) - -## Methods - -### addEvent - - - **Deprecated.** Record this data via [setAttributes](./llm#setattributes) instead. -OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This -method still works and existing span-event data stays valid. -See https://opentelemetry.io/blog/2026/deprecating-span-events/ - -`Example` - -```ts twoslash -// @noErrors -span.addEvent('context_compacted', {removedMessages: 12}); -``` - - -▸ **addEvent**(`name`, `attributes?`, `startTime?`): `this` - -Add a named event to the span. Useful for marking non-span moments such as -context compaction, tool-loop detection, or guardrail trips. Warns and -no-ops after `end()`. Mirrors OTel `Span.addEvent`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `name` | `string` | -| `attributes?` | `Attributes` | -| `startTime?` | `TimeInput` | - -#### Returns - -`this` - -#### Inherited from - -SpanBase.addEvent - -#### Defined in - -[src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - -___ - -### attachMedia - -▸ **attachMedia**(`opts`): `this` - -Stage a media attachment for the LLM call. Pick exactly one of - `content` (inline base64 bytes), `uri` (URI reference), or `fileId` - (pre-uploaded file id). The attachment is glued onto the last user - message in `inputMessages` on `end()`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | `AttachMediaOpts` | - -#### Returns - -`this` - -#### Defined in - -[src/genai/llm.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L183) - -___ - -### 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 - -[src/genai/llm.ts:192](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L192) - -___ - -### end - -▸ **end**(`opts?`): `void` - -Flush accumulated state and close the span. Idempotent. Pass `error` to mark failed; pass `endTime` to backdate the close. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | - -#### Returns - -`void` - -#### Defined in - -[src/genai/llm.ts:274](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L274) - -___ - -### output - -▸ **output**(`content`): `this` - -Append an assistant message to the response. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `content` | `string` | - -#### Returns - -`this` - -#### Defined in - -[src/genai/llm.ts:155](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L155) - -___ - -### 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` | `Object` | -| `opts.finishReasons?` | `string`[] | -| `opts.inputMessages?` | [`Message`](../interfaces/message)[] | -| `opts.mediaAttachments?` | `AttachMediaOpts`[] | -| `opts.outputMessages?` | [`Message`](../interfaces/message)[] | -| `opts.outputType?` | `string` | -| `opts.reasoning?` | [`Reasoning`](../interfaces/reasoning) | -| `opts.responseId?` | `string` | -| `opts.responseModel?` | `string` | -| `opts.usage?` | [`Usage`](../interfaces/usage) | - -#### Returns - -`this` - -#### Defined in - -[src/genai/llm.ts:203](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L203) - -___ - -### setAttributes - -▸ **setAttributes**(`attributes`): `this` - -Set multiple attributes on the span at once. Warns and no-ops after -`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's -`set_attributes`). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `attributes` | `Attributes` | - -#### Returns - -`this` - -`Example` - -```ts twoslash -// @noErrors -span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); -``` - -#### Inherited from - -SpanBase.setAttributes - -#### Defined in - -[src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - -___ - -### 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 - -[src/genai/llm.ts:261](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L261) - -___ - -### 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 - -[src/genai/llm.ts:252](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L252) - -___ - -### 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 - -[src/genai/llm.ts:167](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L167) - -___ - -### create - -▸ **create**(`opts`): [`LLM`](./llm) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`LLMInit`](../interfaces/llminit) & `ChildSpanContext` | - -#### Returns - -[`LLM`](./llm) - -#### Defined in - -[src/genai/llm.ts:124](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L124) \ 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 e57c82a2a7..446300fa68 100644 --- a/weave/reference/typescript-sdk/classes/messagesprompt.mdx +++ b/weave/reference/typescript-sdk/classes/messagesprompt.mdx @@ -3,173 +3,142 @@ title: "MessagesPrompt" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/prompt.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L41) -- `Prompt` - - ↳ `MessagesPrompt` - -## Table of contents - -### Constructors - -- [constructor](./messagesprompt#constructor) - -### Properties - -- [\_\_savedRef](./messagesprompt#__savedref) -- [messages](./messagesprompt#messages) - -### Accessors - -- [description](./messagesprompt#description) -- [name](./messagesprompt#name) +## Extends -### Methods - -- [format](./messagesprompt#format) -- [saveAttrs](./messagesprompt#saveattrs) -- [get](./messagesprompt#get) +- `Prompt` ## Constructors -### constructor +### Constructor + +> **new MessagesPrompt**(`parameters`): `MessagesPrompt` -• **new MessagesPrompt**(`parameters`): [`MessagesPrompt`](./messagesprompt) +Defined in: [src/prompt.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L44) #### Parameters -| Name | Type | -| :------ | :------ | -| `parameters` | `MessagesPromptParameters` | +##### parameters + +`MessagesPromptParameters` #### Returns -[`MessagesPrompt`](./messagesprompt) +`MessagesPrompt` #### Overrides -Prompt.constructor - -#### Defined in - -[src/prompt.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L44) +`Prompt.constructor` ## Properties -### \_\_savedRef - -• `Optional` **\_\_savedRef**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> +### \_\_savedRef? -#### Inherited from +> `optional` **\_\_savedRef?**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> -Prompt.\_\_savedRef +Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) -#### Defined in +#### Inherited from -[src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) +`Prompt.__savedRef` -___ +*** ### messages -• **messages**: `Record`\<`string`, `any`\>[] +> **messages**: `Record`\<`string`, `any`\>[] -#### Defined in - -[src/prompt.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L42) +Defined in: [src/prompt.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L42) ## Accessors ### description -• `get` **description**(): `undefined` \| `string` +#### Get Signature -#### Returns +> **get** **description**(): `string` \| `undefined` -`undefined` \| `string` +Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) -#### Inherited from +##### Returns -Prompt.description +`string` \| `undefined` -#### Defined in +#### Inherited from -[src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) +`Prompt.description` -___ +*** ### name -• `get` **name**(): `string` +#### Get Signature -#### Returns +> **get** **name**(): `string` -`string` +Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) -#### Inherited from +##### Returns -Prompt.name +`string` -#### Defined in +#### Inherited from -[src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) +`Prompt.name` ## Methods -### format +### format() -▸ **format**(`values?`): `Record`\<`string`, `any`\>[] +> **format**(`values?`): `Record`\<`string`, `any`\>[] + +Defined in: [src/prompt.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L71) #### Parameters -| Name | Type | -| :------ | :------ | -| `values` | `Record`\<`string`, `any`\> | +##### values? + +`Record`\<`string`, `any`\> = `{}` #### Returns `Record`\<`string`, `any`\>[] -#### Defined in +*** -[src/prompt.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L71) +### saveAttrs() -___ +> **saveAttrs**(): `object` -### saveAttrs - -▸ **saveAttrs**(): `Object` +Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) #### Returns -`Object` +`object` #### Inherited from -Prompt.saveAttrs - -#### Defined in +`Prompt.saveAttrs` -[src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) +*** -___ +### get() -### get +> `static` **get**(`client`, `uri`): `Promise`\<`MessagesPrompt`\> -▸ **get**(`client`, `uri`): `Promise`\<[`MessagesPrompt`](./messagesprompt)\> +Defined in: [src/prompt.ts:77](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L77) #### Parameters -| Name | Type | -| :------ | :------ | -| `client` | [`WeaveClient`](./weaveclient) | -| `uri` | `string` | +##### client -#### Returns +[`WeaveClient`](../interfaces/weaveclient) + +##### uri -`Promise`\<[`MessagesPrompt`](./messagesprompt)\> +`string` -#### Defined in +#### Returns -[src/prompt.ts:77](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L77) \ No newline at end of file +`Promise`\<`MessagesPrompt`\> \ 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 167cd217c8..90fa967bc8 100644 --- a/weave/reference/typescript-sdk/classes/objectref.mdx +++ b/weave/reference/typescript-sdk/classes/objectref.mdx @@ -3,6 +3,8 @@ title: "ObjectRef" description: "TypeScript SDK reference" --- +Defined in: [src/weaveObject.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L23) + Represents a reference to a saved Weave object. Generally, end users will not need to interact with this class directly. @@ -10,7 +12,7 @@ Generally, end users will not need to interact with this class directly. An ObjectRef contains the project ID, object ID, and digest that uniquely identify a saved object in Weave's storage system. -`Example` +## Example ```ts twoslash // @noErrors @@ -18,150 +20,123 @@ const ref = new ObjectRef('my-project', 'abc123', 'def456'); const uri = ref.uri(); // weave:///my-project/object/abc123:def456 ``` -## Table of contents - -### Constructors +## Constructors -- [constructor](./objectref#constructor) +### Constructor -### Properties +> **new ObjectRef**(`projectId`, `objectId`, `digest`): `ObjectRef` -- [digest](./objectref#digest) -- [objectId](./objectref#objectid) -- [projectId](./objectref#projectid) +Defined in: [src/weaveObject.ts:24](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L24) -### Methods +#### Parameters -- [get](./objectref#get) -- [ui\_url](./objectref#ui_url) -- [uri](./objectref#uri) -- [fromUri](./objectref#fromuri) +##### projectId -## Constructors +`string` -### constructor +##### objectId -• **new ObjectRef**(`projectId`, `objectId`, `digest`): [`ObjectRef`](./objectref) +`string` -#### Parameters +##### digest -| Name | Type | -| :------ | :------ | -| `projectId` | `string` | -| `objectId` | `string` | -| `digest` | `string` | +`string` #### Returns -[`ObjectRef`](./objectref) - -#### Defined in - -[src/weaveObject.ts:24](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L24) +`ObjectRef` ## Properties ### digest -• **digest**: `string` - -#### Defined in +> **digest**: `string` -[src/weaveObject.ts:27](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L27) +Defined in: [src/weaveObject.ts:27](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L27) -___ +*** ### objectId -• **objectId**: `string` +> **objectId**: `string` -#### Defined in +Defined in: [src/weaveObject.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L26) -[src/weaveObject.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L26) - -___ +*** ### projectId -• **projectId**: `string` - -#### Defined in +> **projectId**: `string` -[src/weaveObject.ts:25](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L25) +Defined in: [src/weaveObject.ts:25](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L25) ## Methods -### get +### get() + +> **get**(): `Promise`\<`any`\> -▸ **get**(): `Promise`\<`any`\> +Defined in: [src/weaveObject.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L64) #### Returns `Promise`\<`any`\> -#### Defined in +*** -[src/weaveObject.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L64) +### ui\_url() -___ +> **ui\_url**(): `string` -### ui\_url - -▸ **ui_url**(): `string` +Defined in: [src/weaveObject.ts:59](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L59) #### Returns `string` -#### Defined in - -[src/weaveObject.ts:59](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L59) +*** -___ +### uri() -### uri +> **uri**(): `string` -▸ **uri**(): `string` +Defined in: [src/weaveObject.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L55) #### Returns `string` -#### Defined in - -[src/weaveObject.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L55) +*** -___ +### fromUri() -### fromUri +> `static` **fromUri**(`uri`): `ObjectRef` -▸ **fromUri**(`uri`): [`ObjectRef`](./objectref) +Defined in: [src/weaveObject.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L42) Creates an ObjectRef from a Weave URI string. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `uri` | `string` | A Weave URI in the format: weave:///entity/project/object/name:digest | +##### uri + +`string` + +A Weave URI in the format: weave:///entity/project/object/name:digest #### Returns -[`ObjectRef`](./objectref) +`ObjectRef` A new ObjectRef instance -`Throws` +#### Throws Error if the URI format is invalid or not an object ref -`Example` +#### Example ```ts twoslash // @noErrors const ref = ObjectRef.fromUri('weave:///my-entity/my-project/object/my-dataset:abc123'); -``` - -#### Defined in - -[src/weaveObject.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L42) \ No newline at end of file +``` \ 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 154d62faec..ac0728c5a4 100644 --- a/weave/reference/typescript-sdk/classes/scorelogger.mdx +++ b/weave/reference/typescript-sdk/classes/scorelogger.mdx @@ -3,10 +3,12 @@ title: "ScoreLogger" description: "TypeScript SDK reference" --- +Defined in: [src/evaluationLogger.ts:330](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L330) + ScoreLogger manages scoring for a single prediction. Returned from EvaluationLogger.logPrediction(). -`Example` +## Example ```ts twoslash // @noErrors @@ -16,63 +18,48 @@ await pred.logScore("relevance", 0.8); await pred.finish(); // Finalizes the prediction ``` -## Table of contents - -### Constructors - -- [constructor](./scorelogger#constructor) - -### Accessors - -- [isFinishCalled](./scorelogger#isfinishcalled) - -### Methods - -- [finish](./scorelogger#finish) -- [logScore](./scorelogger#logscore) - ## Constructors -### constructor +### Constructor -• **new ScoreLogger**(`evalLogger`): [`ScoreLogger`](./scorelogger) +> **new ScoreLogger**(`evalLogger`): `ScoreLogger` -#### Parameters +Defined in: [src/evaluationLogger.ts:338](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L338) -| Name | Type | -| :------ | :------ | -| `evalLogger` | [`EvaluationLogger`](./evaluationlogger) | +#### Parameters -#### Returns +##### evalLogger -[`ScoreLogger`](./scorelogger) +[`EvaluationLogger`](./evaluationlogger) -#### Defined in +#### Returns -[src/evaluationLogger.ts:338](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L338) +`ScoreLogger` ## Accessors ### isFinishCalled -• `get` **isFinishCalled**(): `boolean` +#### Get Signature + +> **get** **isFinishCalled**(): `boolean` + +Defined in: [src/evaluationLogger.ts:368](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L368) Check if finish() has been called. Used by EvaluationLogger to detect unfinished predictions. -#### Returns +##### Returns `boolean` -#### Defined in - -[src/evaluationLogger.ts:368](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L368) - ## Methods -### finish +### finish() + +> **finish**(): `Promise`\<`void`\> -▸ **finish**(): `Promise`\<`void`\> +Defined in: [src/evaluationLogger.ts:470](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L470) Finish the scoring process for the prediction. Finalizes the predict_and_score call with accumulated scores. @@ -82,30 +69,31 @@ Updates incremental aggregates and frees memory. `Promise`\<`void`\> -#### Defined in - -[src/evaluationLogger.ts:470](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L470) +*** -___ +### logScore() -### logScore +> **logScore**(`scorerName`, `score`): `Promise`\<`void`\> -▸ **logScore**(`scorerName`, `score`): `Promise`\<`void`\> +Defined in: [src/evaluationLogger.ts:379](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L379) Log a score for this prediction. Creates a scorer call as a child of predict_and_score. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `scorerName` | `string` | Name of the scorer (e.g., "accuracy", "f1_score") | -| `score` | `any` | The score value | +##### scorerName -#### Returns +`string` -`Promise`\<`void`\> +Name of the scorer (e.g., "accuracy", "f1_score") + +##### score -#### Defined in +`any` + +The score value + +#### Returns -[src/evaluationLogger.ts:379](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L379) \ No newline at end of file +`Promise`\<`void`\> \ 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 bdf1aecea9..ca7aecdab6 100644 --- a/weave/reference/typescript-sdk/classes/stringprompt.mdx +++ b/weave/reference/typescript-sdk/classes/stringprompt.mdx @@ -3,173 +3,142 @@ title: "StringPrompt" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/prompt.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L18) -- `Prompt` - - ↳ `StringPrompt` - -## Table of contents - -### Constructors - -- [constructor](./stringprompt#constructor) - -### Properties - -- [\_\_savedRef](./stringprompt#__savedref) -- [content](./stringprompt#content) - -### Accessors - -- [description](./stringprompt#description) -- [name](./stringprompt#name) +## Extends -### Methods - -- [format](./stringprompt#format) -- [saveAttrs](./stringprompt#saveattrs) -- [get](./stringprompt#get) +- `Prompt` ## Constructors -### constructor +### Constructor + +> **new StringPrompt**(`parameters`): `StringPrompt` -• **new StringPrompt**(`parameters`): [`StringPrompt`](./stringprompt) +Defined in: [src/prompt.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L21) #### Parameters -| Name | Type | -| :------ | :------ | -| `parameters` | `StringPromptParameters` | +##### parameters + +`StringPromptParameters` #### Returns -[`StringPrompt`](./stringprompt) +`StringPrompt` #### Overrides -Prompt.constructor - -#### Defined in - -[src/prompt.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L21) +`Prompt.constructor` ## Properties -### \_\_savedRef - -• `Optional` **\_\_savedRef**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> +### \_\_savedRef? -#### Inherited from +> `optional` **\_\_savedRef?**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> -Prompt.\_\_savedRef +Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) -#### Defined in +#### Inherited from -[src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) +`Prompt.__savedRef` -___ +*** ### content -• **content**: `string` +> **content**: `string` -#### Defined in - -[src/prompt.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L19) +Defined in: [src/prompt.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L19) ## Accessors ### description -• `get` **description**(): `undefined` \| `string` +#### Get Signature -#### Returns +> **get** **description**(): `string` \| `undefined` -`undefined` \| `string` +Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) -#### Inherited from +##### Returns -Prompt.description +`string` \| `undefined` -#### Defined in +#### Inherited from -[src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) +`Prompt.description` -___ +*** ### name -• `get` **name**(): `string` +#### Get Signature -#### Returns +> **get** **name**(): `string` -`string` +Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) -#### Inherited from +##### Returns -Prompt.name +`string` -#### Defined in +#### Inherited from -[src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) +`Prompt.name` ## Methods -### format +### format() -▸ **format**(`values?`): `string` +> **format**(`values?`): `string` + +Defined in: [src/prompt.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L26) #### Parameters -| Name | Type | -| :------ | :------ | -| `values` | `Record`\<`string`, `any`\> | +##### values? + +`Record`\<`string`, `any`\> = `{}` #### Returns `string` -#### Defined in +*** -[src/prompt.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L26) +### saveAttrs() -___ +> **saveAttrs**(): `object` -### saveAttrs - -▸ **saveAttrs**(): `Object` +Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) #### Returns -`Object` +`object` #### Inherited from -Prompt.saveAttrs - -#### Defined in +`Prompt.saveAttrs` -[src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) +*** -___ +### get() -### get +> `static` **get**(`client`, `uri`): `Promise`\<`StringPrompt`\> -▸ **get**(`client`, `uri`): `Promise`\<[`StringPrompt`](./stringprompt)\> +Defined in: [src/prompt.ts:30](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L30) #### Parameters -| Name | Type | -| :------ | :------ | -| `client` | [`WeaveClient`](./weaveclient) | -| `uri` | `string` | +##### client -#### Returns +[`WeaveClient`](../interfaces/weaveclient) + +##### uri -`Promise`\<[`StringPrompt`](./stringprompt)\> +`string` -#### Defined in +#### Returns -[src/prompt.ts:30](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L30) \ No newline at end of file +`Promise`\<`StringPrompt`\> \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/subagent.mdx b/weave/reference/typescript-sdk/classes/subagent.mdx deleted file mode 100644 index 6b1f10eb1c..0000000000 --- a/weave/reference/typescript-sdk/classes/subagent.mdx +++ /dev/null @@ -1,204 +0,0 @@ ---- -title: "SubAgent" -description: "TypeScript SDK reference" ---- - -## Hierarchy - -- `SpanBase` - - ↳ `SubAgent` - -## Table of contents - -### Accessors - -- [model](./subagent#model) -- [name](./subagent#name) - -### Methods - -- [addEvent](./subagent#addevent) -- [end](./subagent#end) -- [record](./subagent#record) -- [setAttributes](./subagent#setattributes) -- [create](./subagent#create) - -## Accessors - -### model - -• `get` **model**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/subagent.ts:78](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L78) - -___ - -### name - -• `get` **name**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/subagent.ts:74](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L74) - -## Methods - -### addEvent - - - **Deprecated.** Record this data via [setAttributes](./subagent#setattributes) instead. -OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This -method still works and existing span-event data stays valid. -See https://opentelemetry.io/blog/2026/deprecating-span-events/ - -`Example` - -```ts twoslash -// @noErrors -span.addEvent('context_compacted', {removedMessages: 12}); -``` - - -▸ **addEvent**(`name`, `attributes?`, `startTime?`): `this` - -Add a named event to the span. Useful for marking non-span moments such as -context compaction, tool-loop detection, or guardrail trips. Warns and -no-ops after `end()`. Mirrors OTel `Span.addEvent`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `name` | `string` | -| `attributes?` | `Attributes` | -| `startTime?` | `TimeInput` | - -#### Returns - -`this` - -#### Inherited from - -SpanBase.addEvent - -#### Defined in - -[src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - -___ - -### end - -▸ **end**(`opts?`): `void` - -Read current field values (to reflect mutations made via `record()` -since `start`) and close the span. Idempotent. Pass `error` to mark -it as failed; pass `endTime` to backdate the close. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | - -#### Returns - -`void` - -#### Defined in - -[src/genai/subagent.ts:153](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L153) - -___ - -### record - -▸ **record**(`opts`): `this` - -Bulk-set any fields. Replaces (does not merge). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | `Object` | -| `opts.agentDescription?` | `string` | -| `opts.agentId?` | `string` | -| `opts.agentVersion?` | `string` | -| `opts.model?` | `string` | -| `opts.name?` | `string` | -| `opts.systemInstructions?` | `string`[] | - -#### Returns - -`this` - -#### Defined in - -[src/genai/subagent.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L117) - -___ - -### setAttributes - -▸ **setAttributes**(`attributes`): `this` - -Set multiple attributes on the span at once. Warns and no-ops after -`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's -`set_attributes`). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `attributes` | `Attributes` | - -#### Returns - -`this` - -`Example` - -```ts twoslash -// @noErrors -span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); -``` - -#### Inherited from - -SpanBase.setAttributes - -#### Defined in - -[src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - -___ - -### create - -▸ **create**(`opts`): [`SubAgent`](./subagent) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`SubAgentInit`](../interfaces/subagentinit) & `ChildSpanContext` | - -#### Returns - -[`SubAgent`](./subagent) - -#### Defined in - -[src/genai/subagent.ts:93](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L93) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/tool.mdx b/weave/reference/typescript-sdk/classes/tool.mdx deleted file mode 100644 index 8b556c5996..0000000000 --- a/weave/reference/typescript-sdk/classes/tool.mdx +++ /dev/null @@ -1,213 +0,0 @@ ---- -title: "Tool" -description: "TypeScript SDK reference" ---- - -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 twoslash -// @noErrors -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(); -} -``` - -## Hierarchy - -- `SpanBase` - - ↳ `Tool` - -## Table of contents - -### Properties - -- [args](./tool#args) -- [name](./tool#name) -- [result](./tool#result) -- [toolCallId](./tool#toolcallid) - -### Methods - -- [addEvent](./tool#addevent) -- [end](./tool#end) -- [setAttributes](./tool#setattributes) -- [create](./tool#create) - -## Properties - -### args - -• `Readonly` **args**: `string` - -#### Defined in - -[src/genai/tool.ts:52](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L52) - -___ - -### name - -• `Readonly` **name**: `string` - -#### Defined in - -[src/genai/tool.ts:51](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/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 - -[src/genai/tool.ts:47](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L47) - -___ - -### toolCallId - -• `Readonly` **toolCallId**: `string` - -#### Defined in - -[src/genai/tool.ts:53](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L53) - -## Methods - -### addEvent - - - **Deprecated.** Record this data via [setAttributes](./tool#setattributes) instead. -OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This -method still works and existing span-event data stays valid. -See https://opentelemetry.io/blog/2026/deprecating-span-events/ - -`Example` - -```ts twoslash -// @noErrors -span.addEvent('context_compacted', {removedMessages: 12}); -``` - - -▸ **addEvent**(`name`, `attributes?`, `startTime?`): `this` - -Add a named event to the span. Useful for marking non-span moments such as -context compaction, tool-loop detection, or guardrail trips. Warns and -no-ops after `end()`. Mirrors OTel `Span.addEvent`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `name` | `string` | -| `attributes?` | `Attributes` | -| `startTime?` | `TimeInput` | - -#### Returns - -`this` - -#### Inherited from - -SpanBase.addEvent - -#### Defined in - -[src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - -___ - -### end - -▸ **end**(`opts?`): `void` - -Flush `result` to the span and close it. Idempotent. Pass `error` to mark -the span as failed; pass `endTime` to backdate the close. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | - -#### Returns - -`void` - -#### Defined in - -[src/genai/tool.ts:87](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L87) - -___ - -### setAttributes - -▸ **setAttributes**(`attributes`): `this` - -Set multiple attributes on the span at once. Warns and no-ops after -`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's -`set_attributes`). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `attributes` | `Attributes` | - -#### Returns - -`this` - -`Example` - -```ts twoslash -// @noErrors -span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); -``` - -#### Inherited from - -SpanBase.setAttributes - -#### Defined in - -[src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - -___ - -### create - -▸ **create**(`opts`): [`Tool`](./tool) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`ToolInit`](../interfaces/toolinit) & `ChildSpanContext` | - -#### Returns - -[`Tool`](./tool) - -#### Defined in - -[src/genai/tool.ts:58](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L58) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/turn.mdx b/weave/reference/typescript-sdk/classes/turn.mdx deleted file mode 100644 index dbe66c7d95..0000000000 --- a/weave/reference/typescript-sdk/classes/turn.mdx +++ /dev/null @@ -1,304 +0,0 @@ ---- -title: "Turn" -description: "TypeScript SDK reference" ---- - -## Hierarchy - -- `SpanBase` - - ↳ `Turn` - -## Table of contents - -### Accessors - -- [agentName](./turn#agentname) -- [model](./turn#model) - -### Methods - -- [addEvent](./turn#addevent) -- [end](./turn#end) -- [record](./turn#record) -- [setAttribute](./turn#setattribute) -- [setAttributes](./turn#setattributes) -- [startLLM](./turn#startllm) -- [startSubagent](./turn#startsubagent) -- [startTool](./turn#starttool) -- [create](./turn#create) - -## Accessors - -### agentName - -• `get` **agentName**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/turn.ts:103](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L103) - -___ - -### model - -• `get` **model**(): `string` - -#### Returns - -`string` - -#### Defined in - -[src/genai/turn.ts:107](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L107) - -## Methods - -### addEvent - - - **Deprecated.** Record this data via [setAttributes](./turn#setattributes) instead. -OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This -method still works and existing span-event data stays valid. -See https://opentelemetry.io/blog/2026/deprecating-span-events/ - -`Example` - -```ts twoslash -// @noErrors -span.addEvent('context_compacted', {removedMessages: 12}); -``` - - -▸ **addEvent**(`name`, `attributes?`, `startTime?`): `this` - -Add a named event to the span. Useful for marking non-span moments such as -context compaction, tool-loop detection, or guardrail trips. Warns and -no-ops after `end()`. Mirrors OTel `Span.addEvent`. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `name` | `string` | -| `attributes?` | `Attributes` | -| `startTime?` | `TimeInput` | - -#### Returns - -`this` - -#### Inherited from - -SpanBase.addEvent - -#### Defined in - -[src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - -___ - -### end - -▸ **end**(`opts?`): `void` - -Read current field values (to reflect mutations made via `record()` -since `start`) and close the span. Idempotent. Pass `error` to mark -it as failed; pass `endTime` to backdate the close. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | - -#### Returns - -`void` - -#### Defined in - -[src/genai/turn.ts:241](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L241) - -___ - -### 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` | `Object` | -| `opts.agentDescription?` | `string` | -| `opts.agentId?` | `string` | -| `opts.agentName?` | `string` | -| `opts.agentVersion?` | `string` | -| `opts.messages?` | [`Message`](../interfaces/message)[] | -| `opts.model?` | `string` | -| `opts.systemInstructions?` | `string`[] | - -#### Returns - -`this` - -#### Defined in - -[src/genai/turn.ts:201](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L201) - -___ - -### setAttribute - - - **Deprecated.** Use [setAttributes](./turn#setattributes) instead, which mirrors the Python -SDK's `set_attributes` and OTel's `Span.setAttributes`. Retained as a thin -alias so existing single-attribute callers keep working. Only `Turn` -carries this — the other emitters never shipped a singular form. - - -▸ **setAttribute**(`key`, `value`): `this` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `key` | `string` | -| `value` | `AttributeValue` | - -#### Returns - -`this` - -#### Defined in - -[src/genai/turn.ts:193](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L193) - -___ - -### setAttributes - -▸ **setAttributes**(`attributes`): `this` - -Set multiple attributes on the span at once. Warns and no-ops after -`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's -`set_attributes`). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `attributes` | `Attributes` | - -#### Returns - -`this` - -`Example` - -```ts twoslash -// @noErrors -span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); -``` - -#### Inherited from - -SpanBase.setAttributes - -#### Defined in - -[src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - -___ - -### 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 - -[src/genai/turn.ts:161](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L161) - -___ - -### 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 - -[src/genai/turn.ts:179](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L179) - -___ - -### 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 - -[src/genai/turn.ts:170](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L170) - -___ - -### create - -▸ **create**(`opts?`): [`Turn`](./turn) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`TurnInit`](../interfaces/turninit) & \{ `conversationId?`: `string` } | - -#### Returns - -[`Turn`](./turn) - -#### Defined in - -[src/genai/turn.ts:124](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L124) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx b/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx index 46f0303fbb..cb8b875197 100644 --- a/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx +++ b/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx @@ -3,6 +3,8 @@ title: "WeaveAdkPlugin" description: "TypeScript SDK reference" --- +Defined in: [src/integrations/googleAdk.ts:589](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L589) + ADK plugin that emits runner invocations, agent runs, model calls and tool executions as GenAI-semconv OTel spans on Weave's agents pipeline. @@ -15,96 +17,87 @@ swallows its own errors and returns `undefined`. - `BasePlugin` -## Table of contents +## Constructors -### Constructors +### Constructor -- [constructor](./weaveadkplugin#constructor) +> **new WeaveAdkPlugin**(): `WeaveAdkPlugin` -### Properties +#### Returns -- [name](./weaveadkplugin#name) +`WeaveAdkPlugin` -### Methods +## Properties -- [afterAgentCallback](./weaveadkplugin#afteragentcallback) -- [afterContextCompaction](./weaveadkplugin#aftercontextcompaction) -- [afterModelCallback](./weaveadkplugin#aftermodelcallback) -- [afterRunCallback](./weaveadkplugin#afterruncallback) -- [afterToolCallback](./weaveadkplugin#aftertoolcallback) -- [beforeAgentCallback](./weaveadkplugin#beforeagentcallback) -- [beforeContextCompaction](./weaveadkplugin#beforecontextcompaction) -- [beforeModelCallback](./weaveadkplugin#beforemodelcallback) -- [beforeRunCallback](./weaveadkplugin#beforeruncallback) -- [beforeToolCallback](./weaveadkplugin#beforetoolcallback) -- [beforeToolSelection](./weaveadkplugin#beforetoolselection) -- [finishInterruptedInvocation](./weaveadkplugin#finishinterruptedinvocation) -- [onEventCallback](./weaveadkplugin#oneventcallback) -- [onModelErrorCallback](./weaveadkplugin#onmodelerrorcallback) -- [onToolErrorCallback](./weaveadkplugin#ontoolerrorcallback) -- [onUserMessageCallback](./weaveadkplugin#onusermessagecallback) +### name -## Constructors +> `readonly` **name**: `"weave"` = `WEAVE_ADK_PLUGIN_NAME` -### constructor +Defined in: [src/integrations/googleAdk.ts:590](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L590) -• **new WeaveAdkPlugin**(): [`WeaveAdkPlugin`](./weaveadkplugin) +#### Implementation of -#### Returns +`AdkBasePlugin.name` -[`WeaveAdkPlugin`](./weaveadkplugin) +## Methods -## Properties +### afterAgentCallback() -### name +> **afterAgentCallback**(`params`): `Promise`\<`undefined`\> -• `Readonly` **name**: ``"weave"`` +Defined in: [src/integrations/googleAdk.ts:779](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L779) -#### Implementation of +Callback executed after an agent's primary logic has completed. -AdkBasePlugin.name +This callback can be used to inspect, log, or modify the agent's final +result before it is returned. -#### Defined in +#### Parameters -[src/integrations/googleAdk.ts:590](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L590) +##### params -## Methods +###### agent -### afterAgentCallback +`BaseAgent` -▸ **afterAgentCallback**(`params`): `Promise`\<`undefined`\> +The agent that has just run. -#### Parameters +###### callbackContext + +`Context` -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.agent` | `BaseAgent` | -| `params.callbackContext` | `Context` | +The context for the agent invocation. #### Returns `Promise`\<`undefined`\> +An optional `Content` object. If a value is returned, it will + replace the agent's original result. Returning `undefined` uses the + original, unmodified result. + #### Implementation of -AdkBasePlugin.afterAgentCallback +`AdkBasePlugin.afterAgentCallback` + +*** -#### Defined in +### afterContextCompaction() -[src/integrations/googleAdk.ts:779](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L779) +> **afterContextCompaction**(`_params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:997](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L997) -### afterContextCompaction +Callback executed after context compaction. -▸ **afterContextCompaction**(`_params`): `Promise`\<`undefined`\> +This callback provides an opportunity to inspect the context +after it has been compacted. #### Parameters -| Name | Type | -| :------ | :------ | -| `_params` | `unknown` | +##### \_params + +`unknown` #### Returns @@ -112,128 +105,195 @@ ___ #### Implementation of -AdkBasePlugin.afterContextCompaction +`AdkBasePlugin.afterContextCompaction` + +*** -#### Defined in +### afterModelCallback() -[src/integrations/googleAdk.ts:997](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L997) +> **afterModelCallback**(`params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:841](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L841) -### afterModelCallback +Callback executed after a response is received from the model. -▸ **afterModelCallback**(`params`): `Promise`\<`undefined`\> +This is the ideal place to log model responses, collect metrics on token +usage, or perform post-processing on the raw `LlmResponse`. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.callbackContext` | `Context` | -| `params.llmResponse` | `LlmResponse` | +##### params + +###### callbackContext + +`Context` + +The context for the current agent call. + +###### llmResponse + +`LlmResponse` + +The response object received from the model. #### Returns `Promise`\<`undefined`\> +An optional value. A non-`undefined` return may be used by the + framework to modify or replace the response. Returning `undefined` + allows the original response to be used. + #### Implementation of -AdkBasePlugin.afterModelCallback +`AdkBasePlugin.afterModelCallback` + +*** -#### Defined in +### afterRunCallback() -[src/integrations/googleAdk.ts:841](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L841) +> **afterRunCallback**(`params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:713](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L713) -### afterRunCallback +Callback executed after an ADK runner run has completed. -▸ **afterRunCallback**(`params`): `Promise`\<`undefined`\> +This is the final callback in the ADK lifecycle, suitable for cleanup, +final logging, or reporting tasks. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.invocationContext` | `InvocationContext` | +##### params + +###### invocationContext + +`InvocationContext` + +The context for the entire invocation. #### Returns `Promise`\<`undefined`\> +undefined + #### Implementation of -AdkBasePlugin.afterRunCallback +`AdkBasePlugin.afterRunCallback` -#### Defined in +*** -[src/integrations/googleAdk.ts:713](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L713) +### afterToolCallback() -___ +> **afterToolCallback**(`params`): `Promise`\<`undefined`\> -### afterToolCallback +Defined in: [src/integrations/googleAdk.ts:965](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L965) -▸ **afterToolCallback**(`params`): `Promise`\<`undefined`\> +Callback executed after a tool has been called. + +This callback allows for inspecting, logging, or modifying the result +returned by a tool. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.result` | ``null`` \| `Record`\<`string`, `unknown`\> | -| `params.tool` | `BaseTool` | -| `params.toolArgs` | `Record`\<`string`, `unknown`\> | -| `params.toolContext` | `Context` | +##### params + +###### result + +`Record`\<`string`, `unknown`\> \| `null` + +The dictionary returned by the tool invocation. + +###### tool + +`BaseTool` + +The tool instance that has just been executed. + +###### toolArgs + +`Record`\<`string`, `unknown`\> + +The original arguments that were passed to the tool. + +###### toolContext + +`Context` + +The context specific to the tool execution. #### Returns `Promise`\<`undefined`\> +An optional dictionary. If a dictionary is returned, it will + **replace** the original result from the tool. This allows for + post-processing or altering tool outputs. Returning `undefined` uses + the original, unmodified result. + #### Implementation of -AdkBasePlugin.afterToolCallback +`AdkBasePlugin.afterToolCallback` -#### Defined in +*** -[src/integrations/googleAdk.ts:965](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L965) +### beforeAgentCallback() -___ +> **beforeAgentCallback**(`params`): `Promise`\<`undefined`\> -### beforeAgentCallback +Defined in: [src/integrations/googleAdk.ts:765](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L765) -▸ **beforeAgentCallback**(`params`): `Promise`\<`undefined`\> +Callback executed before an agent's primary logic is invoked. + +This callback can be used for logging, setup, or to short-circuit the +agent's execution by returning a value. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.agent` | `BaseAgent` | -| `params.callbackContext` | `Context` | +##### params + +###### agent + +`BaseAgent` + +The agent that is about to run. + +###### callbackContext + +`Context` + +The context for the agent invocation. #### Returns `Promise`\<`undefined`\> +An optional `Content` object. If a value is returned, it will + bypass the agent's callbacks and its execution, and return this value + directly. Returning `undefined` allows the agent to proceed normally. + #### Implementation of -AdkBasePlugin.beforeAgentCallback +`AdkBasePlugin.beforeAgentCallback` -#### Defined in +*** -[src/integrations/googleAdk.ts:765](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L765) +### beforeContextCompaction() -___ +> **beforeContextCompaction**(`_params`): `Promise`\<`undefined`\> -### beforeContextCompaction +Defined in: [src/integrations/googleAdk.ts:993](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L993) -▸ **beforeContextCompaction**(`_params`): `Promise`\<`undefined`\> +Callback executed before context compaction. + +This callback provides an opportunity to inspect or modify the context +before it is compacted. #### Parameters -| Name | Type | -| :------ | :------ | -| `_params` | `unknown` | +##### \_params + +`unknown` #### Returns @@ -241,119 +301,172 @@ ___ #### Implementation of -AdkBasePlugin.beforeContextCompaction +`AdkBasePlugin.beforeContextCompaction` -#### Defined in +*** -[src/integrations/googleAdk.ts:993](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L993) +### beforeModelCallback() -___ +> **beforeModelCallback**(`params`): `Promise`\<`undefined`\> -### beforeModelCallback +Defined in: [src/integrations/googleAdk.ts:804](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L804) -▸ **beforeModelCallback**(`params`): `Promise`\<`undefined`\> +Callback executed before a request is sent to the model. + +This provides an opportunity to inspect, log, or modify the `LlmRequest` +object. It can also be used to implement caching by returning a cached +`LlmResponse`, which would skip the actual model call. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.callbackContext` | `Context` | -| `params.llmRequest` | `LlmRequest` | +##### params + +###### callbackContext + +`Context` + +The context for the current agent call. + +###### llmRequest + +`LlmRequest` + +The prepared request object to be sent to the model. #### Returns `Promise`\<`undefined`\> +An optional value. The interpretation of a non-`undefined` + trigger an early exit and returns the response immediately. Returning + `undefined` allows the LLM request to proceed normally. + #### Implementation of -AdkBasePlugin.beforeModelCallback +`AdkBasePlugin.beforeModelCallback` -#### Defined in +*** -[src/integrations/googleAdk.ts:804](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L804) +### beforeRunCallback() -___ +> **beforeRunCallback**(`params`): `Promise`\<`undefined`\> -### beforeRunCallback +Defined in: [src/integrations/googleAdk.ts:621](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L621) -▸ **beforeRunCallback**(`params`): `Promise`\<`undefined`\> +Callback executed before the ADK runner runs. + +This is the first callback to be called in the lifecycle, ideal for global +setup or initialization tasks. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.invocationContext` | `InvocationContext` | +##### params + +###### invocationContext + +`InvocationContext` + +The context for the entire invocation, containing + session information, the root agent, etc. #### Returns `Promise`\<`undefined`\> +An optional `Event` to be returned to the ADK. Returning a value + to halt execution of the runner and ends the runner with that event. + Return `undefined` to proceed normally. + #### Implementation of -AdkBasePlugin.beforeRunCallback +`AdkBasePlugin.beforeRunCallback` + +*** -#### Defined in +### beforeToolCallback() -[src/integrations/googleAdk.ts:621](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L621) +> **beforeToolCallback**(`params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:918](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L918) -### beforeToolCallback +Callback executed before a tool is called. -▸ **beforeToolCallback**(`params`): `Promise`\<`undefined`\> +This callback is useful for logging tool usage, input validation, or +modifying the arguments before they are passed to the tool. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.tool` | `BaseTool` | -| `params.toolArgs` | `Record`\<`string`, `unknown`\> | -| `params.toolContext` | `Context` | +##### params + +###### tool + +`BaseTool` + +The tool instance that is about to be executed. + +###### toolArgs + +`Record`\<`string`, `unknown`\> + +The dictionary of arguments to be used for invoking the + tool. + +###### toolContext + +`Context` + +The context specific to the tool execution. #### Returns `Promise`\<`undefined`\> +An optional dictionary. If a dictionary is returned, it will stop + the tool execution and return this response immediately. Returning + `undefined` uses the original, unmodified arguments. + #### Implementation of -AdkBasePlugin.beforeToolCallback +`AdkBasePlugin.beforeToolCallback` -#### Defined in +*** -[src/integrations/googleAdk.ts:918](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L918) +### beforeToolSelection() -___ +> **beforeToolSelection**(`_params`): `Promise`\<`undefined`\> -### beforeToolSelection +Defined in: [src/integrations/googleAdk.ts:914](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L914) -▸ **beforeToolSelection**(`_params`): `Promise`\<`undefined`\> +Callback executed before a tool is selected. + +This callback provides an opportunity to inspect, log, or modify the +available tools before they are selected. #### Parameters -| Name | Type | -| :------ | :------ | -| `_params` | `unknown` | +##### \_params + +`unknown` #### Returns `Promise`\<`undefined`\> -#### Implementation of +An optional value. A non-`undefined` return may be used by the + framework to modify or replace the available tools. Returning + `undefined` allows the original tools to be used. -AdkBasePlugin.beforeToolSelection +#### Implementation of -#### Defined in +`AdkBasePlugin.beforeToolSelection` -[src/integrations/googleAdk.ts:914](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L914) +*** -___ +### finishInterruptedInvocation() -### finishInterruptedInvocation +> **finishInterruptedInvocation**(`invocationId`): `void` -▸ **finishInterruptedInvocation**(`invocationId`): `void` +Defined in: [src/integrations/googleAdk.ts:732](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L732) Finalizes a run that never reached `afterRunCallback`. ADK only dispatches `afterRunCallback` after the event loop drains normally, so a consumer that @@ -364,121 +477,200 @@ has already finished (the common, fully-consumed case). #### Parameters -| Name | Type | -| :------ | :------ | -| `invocationId` | `string` | +##### invocationId + +`string` #### Returns `void` -#### Defined in +*** + +### onEventCallback() -[src/integrations/googleAdk.ts:732](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L732) +> **onEventCallback**(`params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:693](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L693) -### onEventCallback +Callback executed after an event is yielded from runner. -▸ **onEventCallback**(`params`): `Promise`\<`undefined`\> +This is the ideal place to make modification to the event before the event +is handled by the underlying agent app. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.event` | `Event` | -| `params.invocationContext` | `InvocationContext` | +##### params + +###### event + +`Event` + +The event raised by the runner. + +###### invocationContext + +`InvocationContext` + +The context for the entire invocation. #### Returns `Promise`\<`undefined`\> +An optional value. A non-`undefined` return may be used by the + framework to modify or replace the response. Returning `undefined` + allows the original response to be used. + #### Implementation of -AdkBasePlugin.onEventCallback +`AdkBasePlugin.onEventCallback` + +*** -#### Defined in +### onModelErrorCallback() -[src/integrations/googleAdk.ts:693](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L693) +> **onModelErrorCallback**(`params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:884](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L884) -### onModelErrorCallback +Callback executed when a model call encounters an error. -▸ **onModelErrorCallback**(`params`): `Promise`\<`undefined`\> +This callback provides an opportunity to handle model errors gracefully, +potentially providing alternative responses or recovery mechanisms. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.callbackContext` | `Context` | -| `params.error` | `Error` | -| `params.llmRequest` | `LlmRequest` | +##### params + +###### callbackContext + +`Context` + +The context for the current agent call. + +###### error + +`Error` + +The exception that was raised during model execution. + +###### llmRequest + +`LlmRequest` + +The request that was sent to the model when the error + occurred. #### Returns `Promise`\<`undefined`\> +An optional LlmResponse. If an LlmResponse is returned, it will be + used instead of propagating the error. Returning `undefined` allows + the original error to be raised. + #### Implementation of -AdkBasePlugin.onModelErrorCallback +`AdkBasePlugin.onModelErrorCallback` -#### Defined in +*** -[src/integrations/googleAdk.ts:884](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L884) +### onToolErrorCallback() -___ +> **onToolErrorCallback**(`params`): `Promise`\<`undefined`\> -### onToolErrorCallback +Defined in: [src/integrations/googleAdk.ts:977](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L977) -▸ **onToolErrorCallback**(`params`): `Promise`\<`undefined`\> +Callback executed when a tool call encounters an error. + tool: BaseTool; + toolArgs: Record\; + toolContext: Context; + result: Record\; +\}): Promise\ | undefined> \{ + return; +\} + +/** +Callback executed when a tool call encounters an error. + +This callback provides an opportunity to handle tool errors gracefully, +potentially providing alternative responses or recovery mechanisms. #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | `Object` | -| `params.error` | `Error` | -| `params.tool` | `BaseTool` | -| `params.toolArgs` | `Record`\<`string`, `unknown`\> | -| `params.toolContext` | `Context` | +##### params + +###### error + +`Error` + +The exception that was raised during tool execution. + +###### tool + +`BaseTool` + +The tool instance that encountered an error. + +###### toolArgs + +`Record`\<`string`, `unknown`\> + +The arguments that were passed to the tool. + +###### toolContext + +`Context` + +The context specific to the tool execution. #### Returns `Promise`\<`undefined`\> +An optional dictionary. If a dictionary is returned, it will be + used as the tool response instead of propagating the error. Returning + `undefined` allows the original error to be raised. + #### Implementation of -AdkBasePlugin.onToolErrorCallback +`AdkBasePlugin.onToolErrorCallback` + +*** -#### Defined in +### onUserMessageCallback() -[src/integrations/googleAdk.ts:977](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L977) +> **onUserMessageCallback**(`_params`): `Promise`\<`undefined`\> -___ +Defined in: [src/integrations/googleAdk.ts:614](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L614) -### onUserMessageCallback +Callback executed when a user message is received before an invocation +starts. -▸ **onUserMessageCallback**(`_params`): `Promise`\<`undefined`\> +This callback helps logging and modifying the user message before the +runner starts the invocation. #### Parameters -| Name | Type | -| :------ | :------ | -| `_params` | `Object` | -| `_params.invocationContext` | `InvocationContext` | -| `_params.userMessage` | `Content` | +##### \_params + +###### invocationContext + +`InvocationContext` + +###### userMessage + +`Content` #### Returns `Promise`\<`undefined`\> -#### Implementation of - -AdkBasePlugin.onUserMessageCallback +An optional `Content` to be returned to the ADK. Returning a + value to replace the user message. Returning `undefined` to proceed + normally. -#### Defined in +#### Implementation of -[src/integrations/googleAdk.ts:614](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L614) \ No newline at end of file +`AdkBasePlugin.onUserMessageCallback` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/weaveclient.mdx b/weave/reference/typescript-sdk/classes/weaveclient.mdx deleted file mode 100644 index 105a7e5965..0000000000 --- a/weave/reference/typescript-sdk/classes/weaveclient.mdx +++ /dev/null @@ -1,955 +0,0 @@ ---- -title: "WeaveClient" -description: "TypeScript SDK reference" ---- - -## Table of contents - -### Constructors - -- [constructor](./weaveclient#constructor) - -### Properties - -- [projectId](./weaveclient#projectid) -- [settings](./weaveclient#settings) -- [traceServerApi](./weaveclient#traceserverapi) - -### Methods - -- [addScore](./weaveclient#addscore) -- [createCall](./weaveclient#createcall) -- [finishCall](./weaveclient#finishcall) -- [finishCallWithException](./weaveclient#finishcallwithexception) -- [get](./weaveclient#get) -- [getAgentCustomAttributes](./weaveclient#getagentcustomattributes) -- [getAgentSpanStats](./weaveclient#getagentspanstats) -- [getAgentSpans](./weaveclient#getagentspans) -- [getAgentTurn](./weaveclient#getagentturn) -- [getAgentTurns](./weaveclient#getagentturns) -- [getAgentVersions](./weaveclient#getagentversions) -- [getAgents](./weaveclient#getagents) -- [getCall](./weaveclient#getcall) -- [getCallStack](./weaveclient#getcallstack) -- [getCalls](./weaveclient#getcalls) -- [getCallsIterator](./weaveclient#getcallsiterator) -- [getCurrentAttributes](./weaveclient#getcurrentattributes) -- [linkPromptToRegistry](./weaveclient#linkprompttoregistry) -- [publish](./weaveclient#publish) -- [pushNewCall](./weaveclient#pushnewcall) -- [runWithAttributes](./weaveclient#runwithattributes) -- [runWithCallStack](./weaveclient#runwithcallstack) -- [saveCallEnd](./weaveclient#savecallend) -- [saveCallStart](./weaveclient#savecallstart) -- [saveOp](./weaveclient#saveop) -- [searchAgents](./weaveclient#searchagents) -- [serializeAudio](./weaveclient#serializeaudio) -- [updateCall](./weaveclient#updatecall) -- [waitForBatchProcessing](./weaveclient#waitforbatchprocessing) - -## Constructors - -### constructor - -• **new WeaveClient**(`«destructured»`): [`WeaveClient`](./weaveclient) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `«destructured»` | `Object` | -| › `projectId` | `string` | -| › `settings?` | `Partial`\<[`Settings`](../#settings)\> | -| › `traceServerApi` | `Api`\<`any`\> | - -#### Returns - -[`WeaveClient`](./weaveclient) - -#### Defined in - -[src/weaveClient.ts:459](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L459) - -## Properties - -### projectId - -• **projectId**: `string` - -#### Defined in - -[src/weaveClient.ts:456](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L456) - -___ - -### settings - -• **settings**: [`Settings`](../#settings) - -#### Defined in - -[src/weaveClient.ts:457](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L457) - -___ - -### traceServerApi - -• **traceServerApi**: `Api`\<`any`\> - -#### Defined in - -[src/weaveClient.ts:455](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L455) - -## Methods - -### addScore - -▸ **addScore**(`predictCallId`, `scorerCallId`, `runnableRefUri`, `scorerOutput`): `Promise`\<`string`\> - -Add a scorer result (e.g., scorer output) to a call. -Used in imperative evaluation to attach scorer results to predict calls. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `predictCallId` | `string` | ID of the predict call to attach feedback to | -| `scorerCallId` | `string` | ID of the scorer call that generated the feedback | -| `runnableRefUri` | `string` | URI of the scorer (Op or Object ref) | -| `scorerOutput` | `any` | Output of the scorer | - -#### Returns - -`Promise`\<`string`\> - -#### Defined in - -[src/weaveClient.ts:1727](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1727) - -___ - -### createCall - -▸ **createCall**(`internalCall`, `opRef`, `params`, `parameterNames`, `thisArg`, `currentCall`, `parentCall`, `startTime`, `displayName?`, `attributes?`): `Promise`\<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `internalCall` | `InternalCall` | -| `opRef` | `any` | -| `params` | `any`[] | -| `parameterNames` | `ParameterNamesOption` | -| `thisArg` | `any` | -| `currentCall` | `CallStackEntry` | -| `parentCall` | `undefined` \| `CallStackEntry` | -| `startTime` | `Date` | -| `displayName?` | `string` | -| `attributes?` | `Record`\<`string`, `any`\> | - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[src/weaveClient.ts:1570](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1570) - -___ - -### finishCall - -▸ **finishCall**(`call`, `result`, `currentCall`, `parentCall`, `summarize`, `endTime`, `startCallPromise`): `Promise`\<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `call` | `InternalCall` | -| `result` | `any` | -| `currentCall` | `CallStackEntry` | -| `parentCall` | `undefined` \| `CallStackEntry` | -| `summarize` | `undefined` \| (`result`: `any`) => `Record`\<`string`, `any`\> | -| `endTime` | `Date` | -| `startCallPromise` | `Promise`\<`void`\> | - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[src/weaveClient.ts:1630](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1630) - -___ - -### finishCallWithException - -▸ **finishCallWithException**(`call`, `error`, `currentCall`, `parentCall`, `endTime`, `startCallPromise`): `Promise`\<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `call` | `InternalCall` | -| `error` | `any` | -| `currentCall` | `CallStackEntry` | -| `parentCall` | `undefined` \| `CallStackEntry` | -| `endTime` | `Date` | -| `startCallPromise` | `Promise`\<`void`\> | - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[src/weaveClient.ts:1672](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1672) - -___ - -### get - -▸ **get**(`ref`): `Promise`\<`any`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `ref` | [`ObjectRef`](./objectref) | - -#### Returns - -`Promise`\<`any`\> - -#### Defined in - -[src/weaveClient.ts:1025](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1025) - -___ - -### getAgentCustomAttributes - -▸ **getAgentCustomAttributes**(`options`): `Promise`\<[`Response`](../#response)\<`GetAgentCustomAttributesResult`\>\> - -Discover typed custom-attribute keys observed on agent spans in the -project. Each result row is one `(source, key, value_type)` triple plus -a count of how many spans carry it, which is what the spans -query/group/stats APIs use to reference custom attrs. - -Filter the spans considered by passing `query` (a structured span -filter), `startedAfter` / `startedBefore` (ISO-8601), or both. Use -`limit` / `offset` to page through the discovered keys. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | `GetAgentCustomAttributesOptions` | - -#### Returns - -`Promise`\<[`Response`](../#response)\<`GetAgentCustomAttributesResult`\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgentCustomAttributes({ - query: { - $expr: { - $eq: [{$getField: 'agent_name'}, {$literal: 'my-agent'}], - }, - }, - startedAfter: '2026-06-15T00:00:00Z', - limit: 200, -}); - -for (const attr of resp.data.attributes ?? []) { - console.log(`${attr.source}.${attr.key} (${attr.value_type}): ${attr.span_count}`); -} -``` - -#### Defined in - -[src/weaveClient.ts:772](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L772) - -___ - -### getAgentSpanStats - -▸ **getAgentSpanStats**(`options`): `Promise`\<[`Response`](../#response)\<`GetAgentSpanStatsResult`\>\> - -Agregations over agent spans in the project, returned as rows + column -metadata suitable for time-series / bucketed visualizations. - -`start` (required) and `end` define the time window. Each entry in -`metrics` declares a field to extract and how to aggregate it (`sum`, -`avg`, `count`, percentiles, etc.). Pass `granularity` (seconds) to -bucket rows by time, or `groupBy` to break results out per agent / -provider / model / etc. `query` filters the underlying spans before -aggregation. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | `GetAgentSpanStatsOptions` | - -#### Returns - -`Promise`\<[`Response`](../#response)\<`GetAgentSpanStatsResult`\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgentSpanStats({ - start: '2026-06-10T00:00:00Z', - end: '2026-06-23T00:00:00Z', - granularity: 86400, // one row per day - metrics: [ - { - alias: 'total_input_tokens', - value_type: 'number', - aggregations: ['sum'], - value: {source: 'field', key: 'input_tokens'}, - }, - ], - groupBy: [{key: 'agent_name'}], -}); - -for (const row of resp.data.rows ?? []) { - console.log(row.started_at_bucket, row.agent_name, row.total_input_tokens); -} -``` - -#### Defined in - -[src/weaveClient.ts:621](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L621) - -___ - -### getAgentSpans - -▸ **getAgentSpans**(`options`): `Promise`\<[`Response`](../#response)\<[`GetAgentSpansResult`](../#getagentspansresult)\>\> - -Query agent spans, optionally filtered by agent name and/or a mongo-style -query expression. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | [`GetAgentSpansOptions`](../interfaces/getagentspansoptions) | - -#### Returns - -`Promise`\<[`Response`](../#response)\<[`GetAgentSpansResult`](../#getagentspansresult)\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgentSpans({agentName: 'my-agent', limit: 20}); - -for (const span of resp.data.spans) { - console.log(span.span_id, span.span_name, span.input_tokens); -} -``` - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); - -const resp = await client.getAgentSpans({ - agentName: 'my-agent', - query: { - $expr: {$gt: [{$getField: 'input_tokens'}, {$literal: 1000}]}, - }, -}); - -for (const span of resp.data.spans) { - console.log(span.span_id, span.span_name, span.input_tokens); -} -``` - -#### Defined in - -[src/weaveClient.ts:566](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L566) - -___ - -### getAgentTurn - -▸ **getAgentTurn**(`options`): `Promise`\<[`Response`](../#response)\<`AgentTraceChatRes`\>\> - -Get data (including messages) for a single turn (by traceId). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | [`GetAgentTurnOptions`](../interfaces/getagentturnoptions) | - -#### Returns - -`Promise`\<[`Response`](../#response)\<`AgentTraceChatRes`\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgentTurn({ - traceId: '01997b8a-2c89-7c4d-9d0e-2f7e5b9a1b2c', - includeFeedback: true, -}); - -console.log(resp.data.root_span_name, resp.data.total_duration_ms); - -for (const message of resp.data.messages ?? []) { - if (message.user_message) console.log('user:', message.user_message); - if (message.assistant_message) console.log('assistant:', message.assistant_message); -} -``` - -#### Defined in - -[src/weaveClient.ts:655](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L655) - -___ - -### getAgentTurns - -▸ **getAgentTurns**(`options`): `Promise`\<[`Response`](../#response)\<[`GetAgentTurnsResult`](../#getagentturnsresult)\>\> - -Get data (including messages) for many turns (by conversationId). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | [`GetAgentTurnsOptions`](../interfaces/getagentturnsoptions) | - -#### Returns - -`Promise`\<[`Response`](../#response)\<[`GetAgentTurnsResult`](../#getagentturnsresult)\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgentTurns({ - conversationId: 'trace_c50312356de3487fa90e381c9399b5b4', - limit: 20, - includeFeedback: true, -}); - -for (const turn of resp.data.turns ?? []) { - console.log(turn.trace_id, turn.root_span_name); - for (const message of turn.messages ?? []) { - if (message.user_message) console.log('user:', message.user_message); - if (message.assistant_message) console.log('assistant:', message.assistant_message); - } -} - -console.log(`total turns: ${resp.data.total_turns}, has more: ${resp.data.has_more}`); -``` - -#### Defined in - -[src/weaveClient.ts:688](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L688) - -___ - -### getAgentVersions - -▸ **getAgentVersions**(`options`): `Promise`\<[`Response`](../#response)\<[`GetAgentVersionsResult`](../#getagentversionsresult)\>\> - -List versions for a given agent. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | [`GetAgentVersionsOptions`](../interfaces/getagentversionsoptions) | - -#### Returns - -`Promise`\<[`Response`](../#response)\<[`GetAgentVersionsResult`](../#getagentversionsresult)\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgentVersions({agentName: 'my-agent', limit: 20}); - -for (const version of resp.data.versions) { - console.log(version.agent_version, version.total_input_tokens); -} - -console.log(`total count: ${resp.data.total_count}`) -``` - -#### Defined in - -[src/weaveClient.ts:522](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L522) - -___ - -### getAgents - -▸ **getAgents**(`options?`): `Promise`\<[`Response`](../#response)\<[`GetAgentsResult`](../#getagentsresult)\>\> - -List agents with aggregated stats. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | [`GetAgentsOptions`](../interfaces/getagentsoptions) | - -#### Returns - -`Promise`\<[`Response`](../#response)\<[`GetAgentsResult`](../#getagentsresult)\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.getAgents({limit: 20}); - -for (const agent of resp.data.agents) { - console.log(agent.agent_name, agent.total_input_tokens); -} - -console.log(`total count: ${resp.data.total_count}`) -``` - -#### Defined in - -[src/weaveClient.ts:488](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L488) - -___ - -### getCall - -▸ **getCall**(`callId`, `includeCosts?`): `Promise`\<`Call`\> - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `callId` | `string` | `undefined` | -| `includeCosts` | `boolean` | `false` | - -#### Returns - -`Promise`\<`Call`\> - -#### Defined in - -[src/weaveClient.ts:902](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L902) - -___ - -### getCallStack - -▸ **getCallStack**(): `CallStack` - -#### Returns - -`CallStack` - -#### Defined in - -[src/weaveClient.ts:1482](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1482) - -___ - -### getCalls - -▸ **getCalls**(`options?`): `Promise`\<`Call`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options?` | [`GetCallsOptions`](../interfaces/getcallsoptions) | - -#### Returns - -`Promise`\<`Call`[]\> - -#### Defined in - -[src/weaveClient.ts:935](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L935) - -▸ **getCalls**(`options?`, `includeCosts?`, `limit?`): `Promise`\<`Call`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options?` | [`CallsFilter`](../interfaces/callsfilter) | -| `includeCosts?` | `boolean` | -| `limit?` | `number` | - -#### Returns - -`Promise`\<`Call`[]\> - -#### Defined in - -[src/weaveClient.ts:936](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L936) - -___ - -### getCallsIterator - -▸ **getCallsIterator**(`options?`, `includeCosts?`, `limit?`): `AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema), `any`, `any`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options?` | [`CallsFilter`](../interfaces/callsfilter) | -| `includeCosts?` | `boolean` | -| `limit?` | `number` | - -#### Returns - -`AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema), `any`, `any`\> - -#### Defined in - -[src/weaveClient.ts:957](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L957) - -▸ **getCallsIterator**(`options?`): `AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema), `any`, `any`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options?` | [`GetCallsOptions`](../interfaces/getcallsoptions) | - -#### Returns - -`AsyncIterableIterator`\<[`CallSchema`](../interfaces/callschema), `any`, `any`\> - -#### Defined in - -[src/weaveClient.ts:962](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L962) - -___ - -### getCurrentAttributes - -▸ **getCurrentAttributes**(): `Record`\<`string`, `any`\> - -#### Returns - -`Record`\<`string`, `any`\> - -#### Defined in - -[src/weaveClient.ts:1486](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1486) - -___ - -### 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 - -[src/weaveClient.ts:1181](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1181) - -___ - -### publish - -▸ **publish**(`obj`, `objId?`): `Promise`\<[`ObjectRef`](./objectref)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `obj` | `any` | -| `objId?` | `string` | - -#### Returns - -`Promise`\<[`ObjectRef`](./objectref)\> - -#### Defined in - -[src/weaveClient.ts:890](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L890) - -___ - -### pushNewCall - -▸ **pushNewCall**(): `Object` - -#### Returns - -`Object` - -| Name | Type | -| :------ | :------ | -| `currentCall` | `CallStackEntry` | -| `newStack` | `CallStack` | -| `parentCall?` | `CallStackEntry` | - -#### Defined in - -[src/weaveClient.ts:1490](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1490) - -___ - -### runWithAttributes - -▸ **runWithAttributes**\<`T`\>(`attributes`, `fn`): `T` - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `attributes` | `Record`\<`string`, `any`\> | -| `fn` | () => `T` | - -#### Returns - -`T` - -#### Defined in - -[src/weaveClient.ts:1498](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1498) - -___ - -### runWithCallStack - -▸ **runWithCallStack**\<`T`\>(`callStack`, `fn`): `T` - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `callStack` | `CallStack` | -| `fn` | () => `T` | - -#### Returns - -`T` - -#### Defined in - -[src/weaveClient.ts:1494](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1494) - -___ - -### saveCallEnd - -▸ **saveCallEnd**(`callEnd`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `callEnd` | `EndedCallSchemaForInsert` | - -#### Returns - -`void` - -#### Defined in - -[src/weaveClient.ts:1477](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1477) - -___ - -### saveCallStart - -▸ **saveCallStart**(`callStart`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `callStart` | `StartedCallSchemaForInsert` | - -#### Returns - -`void` - -#### Defined in - -[src/weaveClient.ts:1472](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1472) - -___ - -### saveOp - -▸ **saveOp**(`op`, `objId?`): `Promise`\<`OpRef`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `op` | [`Op`](../#op)\<(...`args`: `any`[]) => `any`\> | -| `objId?` | `string` | - -#### Returns - -`Promise`\<`OpRef`\> - -#### Defined in - -[src/weaveClient.ts:1537](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1537) - -___ - -### searchAgents - -▸ **searchAgents**(`options`): `Promise`\<[`Response`](../#response)\<`SearchAgentsResult`\>\> - -Full-text search across agent messages in the project. Returns hits -grouped by conversation, with a preview of each matched message. - -`query` is the full-text search term. Pass an empty string to retrieve -all messages matching the structured filters (`agentName`, -`conversationId`, `traceId`) without text matching. Use `limit` / -`offset` to page through results. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `options` | `SearchAgentsOptions` | - -#### Returns - -`Promise`\<[`Response`](../#response)\<`SearchAgentsResult`\>\> - -`Example` - -```ts twoslash -// @noErrors -const client = await weave.init('entity/project'); -const resp = await client.searchAgents({ - query: 'Liverpool', - agentName: 'Assistant', - limit: 20, -}); - -for (const conversation of resp.data.results ?? []) { - console.log(`${conversation.conversation_id} (${conversation.agent_name})`); - for (const match of conversation.matched_messages) { - console.log(` [${match.role}] ${match.content_preview}`); - } -} - -console.log(`total conversations: ${resp.data.total_conversations}`); -``` - -#### Defined in - -[src/weaveClient.ts:730](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L730) - -___ - -### serializeAudio - -▸ **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. - -Use this when building call outputs manually (e.g. via `saveCallEnd`) -where the automatic serialization pipeline from `finishCall` is not used. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `data` | `Buffer`\<`ArrayBufferLike`\> | `undefined` | Raw audio bytes (WAV for best browser compatibility) | -| `audioType` | ``"wav"`` | `DEFAULT_AUDIO_TYPE` | File format — currently only 'wav' is supported | - -#### Returns - -`Promise`\<`SerializedFileBlob`\> - -#### Defined in - -[src/weaveClient.ts:1424](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1424) - -___ - -### updateCall - -▸ **updateCall**(`callId`, `displayName`): `Promise`\<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `callId` | `string` | -| `displayName` | `string` | - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[src/weaveClient.ts:1710](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1710) - -___ - -### waitForBatchProcessing - -▸ **waitForBatchProcessing**(): `Promise`\<`void`\> - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[src/weaveClient.ts:801](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L801) \ 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 a03d35f163..ec5c433e8e 100644 --- a/weave/reference/typescript-sdk/classes/weaveobject.mdx +++ b/weave/reference/typescript-sdk/classes/weaveobject.mdx @@ -3,101 +3,75 @@ title: "WeaveObject" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/weaveObject.ts:70](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L70) -- `WeaveObject` +## Extended by - ↳ [`Dataset`](./dataset) - - ↳ [`Evaluation`](./evaluation) - -## Table of contents - -### Constructors - -- [constructor](./weaveobject#constructor) - -### Properties - -- [\_\_savedRef](./weaveobject#__savedref) - -### Accessors - -- [description](./weaveobject#description) -- [name](./weaveobject#name) - -### Methods - -- [saveAttrs](./weaveobject#saveattrs) +- [`Dataset`](./dataset) +- [`Evaluation`](./evaluation) ## Constructors -### constructor +### Constructor -• **new WeaveObject**(`_baseParameters`): [`WeaveObject`](./weaveobject) +> **new WeaveObject**(`_baseParameters`): `WeaveObject` -#### Parameters +Defined in: [src/weaveObject.ts:73](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L73) -| Name | Type | -| :------ | :------ | -| `_baseParameters` | `WeaveObjectParameters` | +#### Parameters -#### Returns +##### \_baseParameters -[`WeaveObject`](./weaveobject) +`WeaveObjectParameters` -#### Defined in +#### Returns -[src/weaveObject.ts:73](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L73) +`WeaveObject` ## Properties -### \_\_savedRef +### \_\_savedRef? -• `Optional` **\_\_savedRef**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> +> `optional` **\_\_savedRef?**: [`ObjectRef`](./objectref) \| `Promise`\<[`ObjectRef`](./objectref)\> -#### Defined in - -[src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) +Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71) ## Accessors ### description -• `get` **description**(): `undefined` \| `string` +#### Get Signature -#### Returns +> **get** **description**(): `string` \| `undefined` -`undefined` \| `string` +Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) -#### Defined in +##### Returns -[src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) +`string` \| `undefined` -___ +*** ### name -• `get` **name**(): `string` +#### Get Signature -#### Returns +> **get** **name**(): `string` -`string` +Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) -#### Defined in +##### Returns -[src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) +`string` ## Methods -### saveAttrs +### saveAttrs() -▸ **saveAttrs**(): `Object` +> **saveAttrs**(): `object` -#### Returns +Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) -`Object` - -#### Defined in +#### Returns -[src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) \ No newline at end of file +`object` \ 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 796050e08b..2c154a9c0f 100644 --- a/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx +++ b/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx @@ -3,19 +3,19 @@ title: "createOpenAIAgentsTracingProcessor" description: "TypeScript SDK reference" --- -# createOpenAIAgentsTracingProcessor +> **createOpenAIAgentsTracingProcessor**(): `TracingProcessor` -▸ **createOpenAIAgentsTracingProcessor**(): `TracingProcessor` +Defined in: [src/integrations/openai.agent.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.agent.ts#L102) Create a new Weave tracing processor for OpenAI Agents. -#### Returns +## Returns `TracingProcessor` A TracingProcessor instance that can be registered with OpenAI Agents -`Example` +## Example ```typescript twoslash // @noErrors @@ -24,10 +24,4 @@ import { createOpenAIAgentsTracingProcessor } from 'weave'; const processor = createOpenAIAgentsTracingProcessor(); addTraceProcessor(processor); -``` - -#### Defined in - -[src/integrations/openai.agent.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.agent.ts#L102) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/createotelextension.mdx b/weave/reference/typescript-sdk/functions/createotelextension.mdx index 06d4a5a479..66fa9f68b4 100644 --- a/weave/reference/typescript-sdk/functions/createotelextension.mdx +++ b/weave/reference/typescript-sdk/functions/createotelextension.mdx @@ -3,9 +3,9 @@ title: "createOtelExtension" description: "TypeScript SDK reference" --- -# createOtelExtension +> **createOtelExtension**(`opts?`): (`pi`) => `void` -▸ **createOtelExtension**(`opts?`): (`pi`: `PiExtensionApi`) => `void` +Defined in: [src/integrations/piCodingAgent.ts:654](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/piCodingAgent.ts#L654) Creates a pi coding agent extension that emits OTEL spans for the full agent lifecycle, conforming to the GenAI semantic conventions. @@ -14,39 +14,21 @@ 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 +## Parameters -| Name | Type | -| :------ | :------ | -| `opts` | `OtelExtensionOptions` | +### opts? -#### Returns +`OtelExtensionOptions` = `{}` -`fn` +## Returns -▸ (`pi`): `void` +(`pi`) => `void` -##### Parameters - -| Name | Type | -| :------ | :------ | -| `pi` | `PiExtensionApi` | - -##### Returns - -`void` - -`Example` +## Example ```typescript twoslash // @noErrors const resourceLoader = new DefaultResourceLoader({ extensionFactories: [createOtelExtension()], }); -``` - -#### Defined in - -[src/integrations/piCodingAgent.ts:654](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/piCodingAgent.ts#L654) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/endconversation.mdx b/weave/reference/typescript-sdk/functions/endconversation.mdx index 09278bbdef..db2b4ac308 100644 --- a/weave/reference/typescript-sdk/functions/endconversation.mdx +++ b/weave/reference/typescript-sdk/functions/endconversation.mdx @@ -3,38 +3,30 @@ title: "endConversation" description: "TypeScript SDK reference" --- -# endConversation +> **endConversation**(`opts?`): `void` -▸ **endConversation**(`opts?`): `void` +Defined in: [src/genai/api.ts:159](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L159) End the current Conversation. No-op if no Conversation is active. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | +### opts? -#### Returns +`SpanEndOptions` + +## Returns `void` -`Example` +## Examples ```ts twoslash // @noErrors weave.endConversation(); ``` -`Example` - ```ts twoslash // @noErrors weave.endConversation({endTime: new Date('2026-05-29T10:00:01.700Z')}); -``` - -#### Defined in - -[src/genai/api.ts:159](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L159) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/endllm.mdx b/weave/reference/typescript-sdk/functions/endllm.mdx index b4e90445e5..ffaf6544b5 100644 --- a/weave/reference/typescript-sdk/functions/endllm.mdx +++ b/weave/reference/typescript-sdk/functions/endllm.mdx @@ -3,45 +3,35 @@ title: "endLLM" description: "TypeScript SDK reference" --- -# endLLM +> **endLLM**(`opts?`): `void` -▸ **endLLM**(`opts?`): `void` +Defined in: [src/genai/api.ts:202](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L202) End the current LLM. No-op if no LLM is active. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | +### opts? -#### Returns +`SpanEndOptions` + +## Returns `void` -`Example` +## Examples ```ts twoslash // @noErrors weave.endLLM(); ``` -`Example` - ```ts twoslash // @noErrors weave.endLLM({endTime: new Date('2026-05-29T10:00:00.800Z')}); ``` -`Example` - ```ts twoslash // @noErrors weave.endLLM({error: new Error('llm call failed')}); -``` - -#### Defined in - -[src/genai/api.ts:202](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L202) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/endsession.mdx b/weave/reference/typescript-sdk/functions/endsession.mdx deleted file mode 100644 index 455b1406ad..0000000000 --- a/weave/reference/typescript-sdk/functions/endsession.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "endSession" -description: "TypeScript SDK reference" ---- - -# endSession - - - **Deprecated.** Use [endConversation](./endconversation) instead. - - -▸ **endSession**(`opts?`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | - -#### Returns - -`void` - -#### Defined in - -[src/genai/api.ts:169](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L169) - -___ diff --git a/weave/reference/typescript-sdk/functions/endturn.mdx b/weave/reference/typescript-sdk/functions/endturn.mdx index 564d633377..1be823bedc 100644 --- a/weave/reference/typescript-sdk/functions/endturn.mdx +++ b/weave/reference/typescript-sdk/functions/endturn.mdx @@ -3,45 +3,35 @@ title: "endTurn" description: "TypeScript SDK reference" --- -# endTurn +> **endTurn**(`opts?`): `void` -▸ **endTurn**(`opts?`): `void` +Defined in: [src/genai/api.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L183) End the current Turn. No-op if no Turn is active. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts?` | `SpanEndOptions` | +### opts? -#### Returns +`SpanEndOptions` + +## Returns `void` -`Example` +## Examples ```ts twoslash // @noErrors weave.endTurn(); ``` -`Example` - ```ts twoslash // @noErrors weave.endTurn({endTime: new Date('2026-05-29T10:00:01.700Z')}); ``` -`Example` - ```ts twoslash // @noErrors weave.endTurn({error: new Error('agent loop diverged')}); -``` - -#### Defined in - -[src/genai/api.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L183) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/flushotel.mdx b/weave/reference/typescript-sdk/functions/flushotel.mdx index ffbd3f13b4..8ce83ba0d8 100644 --- a/weave/reference/typescript-sdk/functions/flushotel.mdx +++ b/weave/reference/typescript-sdk/functions/flushotel.mdx @@ -3,9 +3,9 @@ title: "flushOTel" description: "TypeScript SDK reference" --- -# flushOTel +> **flushOTel**(): `Promise`\<`void`\> -▸ **flushOTel**(): `Promise`\<`void`\> +Defined in: [src/genai/flush.ts:15](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/flush.ts#L15) Force-flush any GenAI spans buffered by the active span processor. @@ -18,12 +18,6 @@ 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 +## Returns -`Promise`\<`void`\> - -#### Defined in - -[src/genai/flush.ts:15](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/flush.ts#L15) - -___ +`Promise`\<`void`\> \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/getcurrentconversation.mdx b/weave/reference/typescript-sdk/functions/getcurrentconversation.mdx index 2d91f3b2df..fe1d49aba3 100644 --- a/weave/reference/typescript-sdk/functions/getcurrentconversation.mdx +++ b/weave/reference/typescript-sdk/functions/getcurrentconversation.mdx @@ -3,18 +3,12 @@ title: "getCurrentConversation" description: "TypeScript SDK reference" --- -# getCurrentConversation +> **getCurrentConversation**(): [`Conversation`](../interfaces/conversation) \| `undefined` -▸ **getCurrentConversation**(): [`Conversation`](../classes/conversation) \| `undefined` +Defined in: [src/genai/context.ts:59](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L59) Returns the current Conversation, or undefined. -#### Returns +## Returns -[`Conversation`](../classes/conversation) \| `undefined` - -#### Defined in - -[src/genai/context.ts:59](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L59) - -___ +[`Conversation`](../interfaces/conversation) \| `undefined` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/getcurrentllm.mdx b/weave/reference/typescript-sdk/functions/getcurrentllm.mdx index c85f21f5de..fc49a9fdc9 100644 --- a/weave/reference/typescript-sdk/functions/getcurrentllm.mdx +++ b/weave/reference/typescript-sdk/functions/getcurrentllm.mdx @@ -3,18 +3,12 @@ title: "getCurrentLLM" description: "TypeScript SDK reference" --- -# getCurrentLLM +> **getCurrentLLM**(): [`LLM`](../interfaces/llm) \| `undefined` -▸ **getCurrentLLM**(): [`LLM`](../classes/llm) \| `undefined` +Defined in: [src/genai/context.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L72) Returns the current LLM, or undefined. -#### Returns +## Returns -[`LLM`](../classes/llm) \| `undefined` - -#### Defined in - -[src/genai/context.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L72) - -___ +[`LLM`](../interfaces/llm) \| `undefined` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/getcurrentsession.mdx b/weave/reference/typescript-sdk/functions/getcurrentsession.mdx deleted file mode 100644 index 92ae9ca876..0000000000 --- a/weave/reference/typescript-sdk/functions/getcurrentsession.mdx +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "getCurrentSession" -description: "TypeScript SDK reference" ---- - -# getCurrentSession - - - **Deprecated.** Use [getCurrentConversation](./getcurrentconversation) instead. - - -▸ **getCurrentSession**(): [`Conversation`](../classes/conversation) \| `undefined` - -#### Returns - -[`Conversation`](../classes/conversation) \| `undefined` - -#### Defined in - -[src/genai/context.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L64) - -___ diff --git a/weave/reference/typescript-sdk/functions/getcurrentturn.mdx b/weave/reference/typescript-sdk/functions/getcurrentturn.mdx index 7735ec78a7..cca9875b3e 100644 --- a/weave/reference/typescript-sdk/functions/getcurrentturn.mdx +++ b/weave/reference/typescript-sdk/functions/getcurrentturn.mdx @@ -3,18 +3,12 @@ title: "getCurrentTurn" description: "TypeScript SDK reference" --- -# getCurrentTurn +> **getCurrentTurn**(): [`Turn`](../interfaces/turn) \| `undefined` -▸ **getCurrentTurn**(): [`Turn`](../classes/turn) \| `undefined` +Defined in: [src/genai/context.ts:67](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L67) Returns the current Turn, or undefined. -#### Returns +## Returns -[`Turn`](../classes/turn) \| `undefined` - -#### Defined in - -[src/genai/context.ts:67](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L67) - -___ +[`Turn`](../interfaces/turn) \| `undefined` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/init.mdx b/weave/reference/typescript-sdk/functions/init.mdx index 44b7df9ba8..572f1df266 100644 --- a/weave/reference/typescript-sdk/functions/init.mdx +++ b/weave/reference/typescript-sdk/functions/init.mdx @@ -3,31 +3,35 @@ title: "init" description: "TypeScript SDK reference" --- -# init +> **init**(`project`, `settings?`): `Promise`\<[`WeaveClient`](../interfaces/weaveclient)\> -▸ **init**(`project`, `settings?`): `Promise`\<[`WeaveClient`](../classes/weaveclient)\> +Defined in: [src/clientApi.ts:87](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L87) Initialize the Weave client, which is required for weave tracing to work. -#### Parameters +## Parameters -| 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/platform/app/settings-page/user-settings#default-team | -| `settings?` | `Partial`\<[`Settings`](../type-aliases/settings)\> | (Optional) Weave tracing settings | +### project -#### Returns +`string` -`Promise`\<[`WeaveClient`](../classes/weaveclient)\> +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 -A promise that resolves to the initialized Weave client. +### settings? + +`Partial`\<[`Settings`](../type-aliases/settings)\> -`Throws` +(Optional) Weave tracing settings -If the initialization fails +## Returns -#### Defined in +`Promise`\<[`WeaveClient`](../interfaces/weaveclient)\> + +A promise that resolves to the initialized Weave client. -[src/clientApi.ts:87](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L87) +## Throws -___ +If the initialization fails \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx b/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx index 5282596464..fbfd29f203 100644 --- a/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx +++ b/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx @@ -3,9 +3,9 @@ title: "instrumentOpenAIAgents" description: "TypeScript SDK reference" --- -# instrumentOpenAIAgents +> **instrumentOpenAIAgents**(): `Promise`\<`boolean`\> -▸ **instrumentOpenAIAgents**(): `Promise`\<`boolean`\> +Defined in: [src/integrations/openai.agent.ts:169](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.agent.ts#L169) Manually register Weave tracing with OpenAI Agents if the package is available. @@ -18,13 +18,13 @@ This function attempts to dynamically import @openai/agents from the consumer's and registers a TracingProcessor. If the package is not installed, it returns false without throwing an error. -#### Returns +## Returns `Promise`\<`boolean`\> `Promise` - `true` if registration succeeded, `false` if `@openai/agents` not available -`Example` +## Examples ```typescript twoslash // @noErrors @@ -38,8 +38,6 @@ const agent = new Agent({ ... }); await agent.run(input); // Automatically traced in Weave ``` -`Example` - ```typescript twoslash // @noErrors // ⚠️ Only needed for edge cases where automatic hooks don't work @@ -51,7 +49,7 @@ if (!registered) { } ``` -`Remarks` +## Remarks **How automatic instrumentation works**: When you import Weave, it registers module loader hooks via `addCJSInstrumentation()` and `addESMInstrumentation()`. When your code later @@ -72,10 +70,4 @@ import { createOpenAIAgentsTracingProcessor } from 'weave'; const processor = createOpenAIAgentsTracingProcessor(); addTraceProcessor(processor); -``` - -#### Defined in - -[src/integrations/openai.agent.ts:169](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.agent.ts#L169) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/login.mdx b/weave/reference/typescript-sdk/functions/login.mdx index a9aa82b20a..88842a97dc 100644 --- a/weave/reference/typescript-sdk/functions/login.mdx +++ b/weave/reference/typescript-sdk/functions/login.mdx @@ -3,31 +3,32 @@ title: "login" description: "TypeScript SDK reference" --- -# login +> **login**(`apiKey`, `host?`): `Promise`\<`void`\> -▸ **login**(`apiKey`, `host?`): `Promise`\<`void`\> +Defined in: [src/clientApi.ts:27](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L27) Log in to Weights & Biases (W&B) using the provided API key. This function attempts to save the credentials to your netrc file for future use, but will continue even if it cannot write to the file system. -#### Parameters +## Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `apiKey` | `string` | Your W&B API key. | -| `host?` | `string` | (Optional) The host name (usually only needed if you're using a custom W&B server). | +### apiKey -#### Returns +`string` -`Promise`\<`void`\> +Your W&B API key. + +### host? -`Throws` +`string` -If the API key is not specified or if the connection to the weave trace server cannot be verified. +(Optional) The host name (usually only needed if you're using a custom W&B server). -#### Defined in +## Returns + +`Promise`\<`void`\> -[src/clientApi.ts:27](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L27) +## Throws -___ +If the API key is not specified or if the connection to the weave trace server cannot be verified. \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/op.mdx b/weave/reference/typescript-sdk/functions/op.mdx index 0009a0a627..bb9dab9be8 100644 --- a/weave/reference/typescript-sdk/functions/op.mdx +++ b/weave/reference/typescript-sdk/functions/op.mdx @@ -3,110 +3,124 @@ title: "op" description: "TypeScript SDK reference" --- -# op +## Call Signature -▸ **op**\<`T`\>(`fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> +> **op**\<`T`\>(`fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> -#### Type parameters +Defined in: [src/op.ts:380](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L380) -| Name | Type | -| :------ | :------ | -| `T` | extends (...`args`: `any`[]) => `any` | +### Type Parameters -#### Parameters +#### T -| Name | Type | -| :------ | :------ | -| `fn` | `T` | -| `options?` | `OpOptions`\<`T`\> | +`T` *extends* (...`args`) => `any` -#### Returns +### Parameters + +#### fn + +`T` + +#### options? + +`OpOptions`\<`T`\> + +### Returns [`Op`](../type-aliases/op)\<`T`\> -#### Defined in +## Call Signature + +> **op**\<`T`\>(`thisArg`, `fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> + +Defined in: [src/op.ts:385](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L385) + +### Type Parameters + +#### T + +`T` *extends* (...`args`) => `any` + +### Parameters -[src/op.ts:380](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L380) +#### thisArg -▸ **op**\<`T`\>(`thisArg`, `fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> +`any` -#### Type parameters +#### fn -| Name | Type | -| :------ | :------ | -| `T` | extends (...`args`: `any`[]) => `any` | +`T` -#### Parameters +#### options? -| Name | Type | -| :------ | :------ | -| `thisArg` | `any` | -| `fn` | `T` | -| `options?` | `OpOptions`\<`T`\> | +`OpOptions`\<`T`\> -#### Returns +### Returns [`Op`](../type-aliases/op)\<`T`\> -#### Defined in +## Call Signature -[src/op.ts:385](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L385) +> **op**(`target`, `propertyKey`, `descriptor`): `TypedPropertyDescriptor`\<`any`\> -▸ **op**(`target`, `propertyKey`, `descriptor`): `TypedPropertyDescriptor`\<`any`\> +Defined in: [src/op.ts:391](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L391) -#### Parameters +### Parameters -| Name | Type | -| :------ | :------ | -| `target` | `object` | -| `propertyKey` | `string` \| `symbol` | -| `descriptor` | `TypedPropertyDescriptor`\<`any`\> | +#### target -#### Returns +`object` + +#### propertyKey + +`string` \| `symbol` + +#### descriptor `TypedPropertyDescriptor`\<`any`\> -#### Defined in +### Returns -[src/op.ts:391](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L391) +`TypedPropertyDescriptor`\<`any`\> -▸ **op**\<`T`\>(`value`, `context`): [`Op`](../type-aliases/op)\<`T`\> +## Call Signature -#### Type parameters +> **op**\<`T`\>(`value`, `context`): [`Op`](../type-aliases/op)\<`T`\> -| Name | Type | -| :------ | :------ | -| `T` | extends (...`args`: `any`[]) => `any` | +Defined in: [src/op.ts:397](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L397) -#### Parameters +### Type Parameters -| Name | Type | -| :------ | :------ | -| `value` | `T` | -| `context` | `MethodDecoratorContext` | +#### T -#### Returns +`T` *extends* (...`args`) => `any` -[`Op`](../type-aliases/op)\<`T`\> +### Parameters -#### Defined in +#### value -[src/op.ts:397](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L397) +`T` + +#### context + +`MethodDecoratorContext` + +### Returns + +[`Op`](../type-aliases/op)\<`T`\> -▸ **op**(`options`): `MethodDecorator` +## Call Signature -#### Parameters +> **op**(`options`): `MethodDecorator` -| Name | Type | -| :------ | :------ | -| `options` | `Partial`\<`OpOptions`\<`any`\>\> | +Defined in: [src/op.ts:402](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L402) -#### Returns +### Parameters -`MethodDecorator` +#### options -#### Defined in +`Partial`\<`OpOptions`\<`any`\>\> -[src/op.ts:402](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L402) +### Returns -___ +`MethodDecorator` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx b/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx index 681e41c6b9..c93d9855de 100644 --- a/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx +++ b/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx @@ -3,9 +3,9 @@ title: "patchRealtimeSession" description: "TypeScript SDK reference" --- -# patchRealtimeSession +> **patchRealtimeSession**(): `Promise`\<`boolean`\> -▸ **patchRealtimeSession**(): `Promise`\<`boolean`\> +Defined in: [src/integrations/openai.realtime.agent.ts:836](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.realtime.agent.ts#L836) Manually patch the `RealtimeSession` class from `@openai/agents-realtime` so that every new instance is automatically traced by Weave. @@ -18,24 +18,18 @@ imports, bundlers that bypass hooks). Call this **once** at app startup, before any `RealtimeSession` is constructed. The function is idempotent — safe to call multiple times. -#### Returns +## Returns `Promise`\<`boolean`\> `true` if the patch was applied (or was already in place), `false` if `@openai/agents-realtime` could not be loaded. -`Example` +## Example ```typescript twoslash // @noErrors import { patchRealtimeSession } from 'weave'; await patchRealtimeSession(); // Every new RealtimeSession(...) is now auto-instrumented -``` - -#### Defined in - -[src/integrations/openai.realtime.agent.ts:836](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.realtime.agent.ts#L836) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx index 9df530ab34..605747abce 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx @@ -3,16 +3,10 @@ title: "requireCurrentCallStackEntry" description: "TypeScript SDK reference" --- -# requireCurrentCallStackEntry +> **requireCurrentCallStackEntry**(): `CallStackEntry` -▸ **requireCurrentCallStackEntry**(): `CallStackEntry` +Defined in: [src/clientApi.ts:163](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L163) -#### Returns +## Returns -`CallStackEntry` - -#### Defined in - -[src/clientApi.ts:163](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L163) - -___ +`CallStackEntry` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx index 0ad477f627..9b5243bbc2 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx @@ -3,16 +3,10 @@ title: "requireCurrentChildSummary" description: "TypeScript SDK reference" --- -# requireCurrentChildSummary +> **requireCurrentChildSummary**(): `object` -▸ **requireCurrentChildSummary**(): `Object` +Defined in: [src/clientApi.ts:175](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L175) -#### Returns +## Returns -`Object` - -#### Defined in - -[src/clientApi.ts:175](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L175) - -___ +`object` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/runisolated.mdx b/weave/reference/typescript-sdk/functions/runisolated.mdx index f8739a0556..d86a8728f5 100644 --- a/weave/reference/typescript-sdk/functions/runisolated.mdx +++ b/weave/reference/typescript-sdk/functions/runisolated.mdx @@ -3,9 +3,9 @@ title: "runIsolated" description: "TypeScript SDK reference" --- -# runIsolated +> **runIsolated**\<`T`\>(`fn`): `T` -▸ **runIsolated**\<`T`\>(`fn`): `T` +Defined in: [src/genai/context.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L54) Run `fn` in a fresh, isolated GenAI state frame. Any Conversation / Turn / LLM started inside `fn` lives in this frame only — it does not clash with @@ -24,24 +24,18 @@ Use this to safely run parallel GenAI work: Sequential single-flight usage doesn't require this wrapper — the process-wide default state handles it. -#### Type parameters +## Type Parameters -| Name | -| :------ | -| `T` | +### T -#### Parameters - -| Name | Type | -| :------ | :------ | -| `fn` | () => `T` | +`T` -#### Returns +## Parameters -`T` +### fn -#### Defined in +() => `T` -[src/genai/context.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L54) +## Returns -___ +`T` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/startconversation.mdx b/weave/reference/typescript-sdk/functions/startconversation.mdx index e0670647fe..b69d16f91c 100644 --- a/weave/reference/typescript-sdk/functions/startconversation.mdx +++ b/weave/reference/typescript-sdk/functions/startconversation.mdx @@ -3,9 +3,9 @@ title: "startConversation" description: "TypeScript SDK reference" --- -# startConversation +> **startConversation**(`opts?`): [`Conversation`](../interfaces/conversation) -▸ **startConversation**(`opts?`): [`Conversation`](../classes/conversation) +Defined in: [src/genai/api.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L26) Start a new Conversation and install it as the current conversation. Subsequent calls to `startTurn` will pick it up automatically. @@ -13,25 +13,23 @@ Subsequent calls to `startTurn` will pick it up automatically. Pass `attributes` to stamp custom (non-semconv) attributes on every span the conversation emits. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`ConversationInit`](../interfaces/conversationinit) | +### opts? -#### Returns +[`ConversationInit`](../interfaces/conversationinit) = `{}` -[`Conversation`](../classes/conversation) +## Returns -`Example` +[`Conversation`](../interfaces/conversation) + +## Examples ```ts twoslash // @noErrors weave.startConversation({agentName: 'research-bot'}); ``` -`Example` - ```ts twoslash // @noErrors weave.startConversation({ @@ -39,10 +37,4 @@ weave.startConversation({ conversationId: '019efa53-8a65-711c-b4c1-7c1cb72c0bb7', attributes: {'myagent.version': '1.23'}, }); -``` - -#### Defined in - -[src/genai/api.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L26) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/startllm.mdx b/weave/reference/typescript-sdk/functions/startllm.mdx index b0eb5c8b7b..0b4fd852b8 100644 --- a/weave/reference/typescript-sdk/functions/startllm.mdx +++ b/weave/reference/typescript-sdk/functions/startllm.mdx @@ -3,32 +3,30 @@ title: "startLLM" description: "TypeScript SDK reference" --- -# startLLM +> **startLLM**(`opts`): [`LLM`](../interfaces/llm) -▸ **startLLM**(`opts`): [`LLM`](../classes/llm) +Defined in: [src/genai/api.ts:77](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L77) Start an LLM span as a child of the current Turn. Throws if no Turn is active. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`LLMInit`](../interfaces/llminit) | +### opts -#### Returns +[`LLMInit`](../interfaces/llminit) -[`LLM`](../classes/llm) +## Returns -`Example` +[`LLM`](../interfaces/llm) + +## Examples ```ts twoslash // @noErrors weave.startLLM({model: 'gpt-4o-mini', providerName: 'openai'}); ``` -`Example` - ```ts twoslash // @noErrors weave.startLLM({ @@ -37,10 +35,4 @@ weave.startLLM({ systemInstructions: ['You are a helpful weather bot.'], startTime: new Date('2026-05-29T10:00:00.000Z'), }); -``` - -#### Defined in - -[src/genai/api.ts:77](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L77) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/startsession.mdx b/weave/reference/typescript-sdk/functions/startsession.mdx deleted file mode 100644 index 0529b0711b..0000000000 --- a/weave/reference/typescript-sdk/functions/startsession.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "startSession" -description: "TypeScript SDK reference" ---- - -# startSession - - - **Deprecated.** Use [startConversation](./startconversation) instead. - - -▸ **startSession**(`opts?`): [`Conversation`](../classes/conversation) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts` | [`ConversationInit`](../interfaces/conversationinit) | - -#### Returns - -[`Conversation`](../classes/conversation) - -#### Defined in - -[src/genai/api.ts:33](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L33) - -___ diff --git a/weave/reference/typescript-sdk/functions/startsubagent.mdx b/weave/reference/typescript-sdk/functions/startsubagent.mdx index 0f9b7100c3..39478e3396 100644 --- a/weave/reference/typescript-sdk/functions/startsubagent.mdx +++ b/weave/reference/typescript-sdk/functions/startsubagent.mdx @@ -3,31 +3,29 @@ title: "startSubagent" description: "TypeScript SDK reference" --- -# startSubagent +> **startSubagent**(`opts`): [`SubAgent`](../interfaces/subagent) -▸ **startSubagent**(`opts`): [`SubAgent`](../classes/subagent) +Defined in: [src/genai/api.ts:137](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L137) Start a SubAgent span. Same parent-resolution rules as `startTool`. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`SubAgentInit`](../interfaces/subagentinit) | +### opts -#### Returns +[`SubAgentInit`](../interfaces/subagentinit) -[`SubAgent`](../classes/subagent) +## Returns -`Example` +[`SubAgent`](../interfaces/subagent) + +## Examples ```ts twoslash // @noErrors weave.startSubagent({name: 'critic'}); ``` -`Example` - ```ts twoslash // @noErrors weave.startSubagent({ @@ -36,10 +34,4 @@ weave.startSubagent({ systemInstructions: ['Critique the proposed plan.'], startTime: new Date('2026-05-29T10:00:00.000Z'), }); -``` - -#### Defined in - -[src/genai/api.ts:137](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L137) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/starttool.mdx b/weave/reference/typescript-sdk/functions/starttool.mdx index 6a2c0f7f23..07fcab7d11 100644 --- a/weave/reference/typescript-sdk/functions/starttool.mdx +++ b/weave/reference/typescript-sdk/functions/starttool.mdx @@ -3,9 +3,9 @@ title: "startTool" description: "TypeScript SDK reference" --- -# startTool +> **startTool**(`opts`): [`Tool`](../interfaces/tool) -▸ **startTool**(`opts`): [`Tool`](../classes/tool) +Defined in: [src/genai/api.ts:110](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L110) Start a Tool span. Parent resolution (matches the design's "flat by default, hierarchical if you nest"): @@ -14,17 +14,17 @@ default, hierarchical if you nest"): Throws if neither a Turn nor an LLM is active. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`ToolInit`](../interfaces/toolinit) | +### opts -#### Returns +[`ToolInit`](../interfaces/toolinit) -[`Tool`](../classes/tool) +## Returns -`Example` +[`Tool`](../interfaces/tool) + +## Examples ```ts twoslash // @noErrors @@ -35,8 +35,6 @@ weave.startTool({ }); ``` -`Example` - ```ts twoslash // @noErrors weave.startTool({ @@ -45,10 +43,4 @@ weave.startTool({ toolCallId: 'call_t1', startTime: new Date('2026-05-29T10:00:00.800Z'), }); -``` - -#### Defined in - -[src/genai/api.ts:110](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L110) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/startturn.mdx b/weave/reference/typescript-sdk/functions/startturn.mdx index 3580846e29..ddb3a27769 100644 --- a/weave/reference/typescript-sdk/functions/startturn.mdx +++ b/weave/reference/typescript-sdk/functions/startturn.mdx @@ -3,32 +3,30 @@ title: "startTurn" description: "TypeScript SDK reference" --- -# startTurn +> **startTurn**(`opts?`): [`Turn`](../interfaces/turn) -▸ **startTurn**(`opts?`): [`Turn`](../classes/turn) +Defined in: [src/genai/api.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L54) Start a new Turn. If a Conversation is active, the turn inherits its `conversationId`; otherwise the turn has no conversation id. -#### Parameters +## Parameters -| Name | Type | -| :------ | :------ | -| `opts` | [`TurnInit`](../interfaces/turninit) | +### opts? -#### Returns +[`TurnInit`](../interfaces/turninit) = `{}` -[`Turn`](../classes/turn) +## Returns -`Example` +[`Turn`](../interfaces/turn) + +## Examples ```ts twoslash // @noErrors weave.startTurn(); ``` -`Example` - ```ts twoslash // @noErrors weave.startTurn({ @@ -41,10 +39,4 @@ weave.startTurn({ systemInstructions: ['You are a helpful weather bot.'], startTime: new Date('2026-05-29T10:00:00.000Z'), }); -``` - -#### Defined in - -[src/genai/api.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L54) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/weaveaudio.mdx b/weave/reference/typescript-sdk/functions/weaveaudio.mdx index 8ea67fec69..5497630673 100644 --- a/weave/reference/typescript-sdk/functions/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/functions/weaveaudio.mdx @@ -3,32 +3,30 @@ title: "weaveAudio" description: "TypeScript SDK reference" --- -# weaveAudio +> **weaveAudio**(`options`): [`WeaveAudio`](../interfaces/weaveaudio) -▸ **weaveAudio**(`options`): [`WeaveAudio`](../interfaces/weaveaudio) +Defined in: [src/media.ts:62](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L62) Create a new WeaveAudio object -#### Parameters +## Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | `WeaveAudioInput` | The options for this media type - data: The raw audio data as a Buffer - audioType: (Optional) The type of audio file, currently only 'wav' is supported | +### options -#### Returns +`WeaveAudioInput` + +The options for this media type + - data: The raw audio data as a Buffer + - audioType: (Optional) The type of audio file, currently only 'wav' is supported + +## Returns [`WeaveAudio`](../interfaces/weaveaudio) -`Example` +## Example ```ts twoslash // @noErrors const audioBuffer = fs.readFileSync('path/to/audio.wav'); const weaveAudio = weaveAudio({ data: audioBuffer }); -``` - -#### Defined in - -[src/media.ts:62](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L62) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/weaveimage.mdx b/weave/reference/typescript-sdk/functions/weaveimage.mdx index 1ac429f919..56cbac96ec 100644 --- a/weave/reference/typescript-sdk/functions/weaveimage.mdx +++ b/weave/reference/typescript-sdk/functions/weaveimage.mdx @@ -3,32 +3,30 @@ title: "weaveImage" description: "TypeScript SDK reference" --- -# weaveImage +> **weaveImage**(`options`): [`WeaveImage`](../interfaces/weaveimage) -▸ **weaveImage**(`options`): [`WeaveImage`](../interfaces/weaveimage) +Defined in: [src/media.ts:28](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L28) Create a new WeaveImage object -#### Parameters +## Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | `WeaveImageInput` | The options for this media type - data: The raw image data as a Buffer - imageType: (Optional) The type of image file, currently only 'png' is supported | +### options -#### Returns +`WeaveImageInput` + +The options for this media type + - data: The raw image data as a Buffer + - imageType: (Optional) The type of image file, currently only 'png' is supported + +## Returns [`WeaveImage`](../interfaces/weaveimage) -`Example` +## Example ```ts twoslash // @noErrors const imageBuffer = fs.readFileSync('path/to/image.png'); const weaveImage = weaveImage({ data: imageBuffer }); -``` - -#### Defined in - -[src/media.ts:28](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L28) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/withattributes.mdx b/weave/reference/typescript-sdk/functions/withattributes.mdx index fe213929ee..1a660497cb 100644 --- a/weave/reference/typescript-sdk/functions/withattributes.mdx +++ b/weave/reference/typescript-sdk/functions/withattributes.mdx @@ -3,9 +3,9 @@ title: "withAttributes" description: "TypeScript SDK reference" --- -# withAttributes +> **withAttributes**\<`T`\>(`attrs`, `fn`): `T` \| `Promise`\<`T`\> -▸ **withAttributes**\<`T`\>(`attrs`, `fn`): `Promise`\<`T`\> \| `T` +Defined in: [src/clientApi.ts:209](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L209) Attach attributes to the current execution context so that any calls created inside `fn` automatically inherit them. Attributes are written to the call @@ -20,25 +20,22 @@ await withAttributes({requestId: 'abc'}, async () => { }); ``` -#### Type parameters +## Type Parameters -| Name | -| :------ | -| `T` | +### T -#### Parameters +`T` -| Name | Type | -| :------ | :------ | -| `attrs` | `Record`\<`string`, `any`\> | -| `fn` | () => `T` \| `Promise`\<`T`\> | +## Parameters -#### Returns +### attrs -`Promise`\<`T`\> \| `T` +`Record`\<`string`, `any`\> -#### Defined in +### fn -[src/clientApi.ts:209](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L209) +() => `T` \| `Promise`\<`T`\> -___ +## Returns + +`T` \| `Promise`\<`T`\> \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx b/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx index 6d6311ca7e..628c27b5cb 100644 --- a/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx +++ b/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx @@ -3,9 +3,9 @@ title: "wrapClaudeAgentSdk" description: "TypeScript SDK reference" --- -# wrapClaudeAgentSdk +> **wrapClaudeAgentSdk**\<`T`\>(`sdk`): `T` -▸ **wrapClaudeAgentSdk**\<`T`\>(`sdk`): `T` +Defined in: [src/integrations/claudeAgentSdk.ts:209](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/claudeAgentSdk.ts#L209) Manually instrument the `@anthropic-ai/claude-agent-sdk` module. @@ -16,23 +16,23 @@ view of the module whose `query` export is traced; use the returned object rather than the original import (the SDK's `query` is a getter-only export, so the original binding can't be patched in place): -#### Type parameters +## Type Parameters -| Name | -| :------ | -| `T` | +### T -#### Parameters +`T` + +## Parameters -| Name | Type | -| :------ | :------ | -| `sdk` | `T` | +### sdk + +`T` -#### Returns +## Returns `T` -`Example` +## Example ```ts twoslash // @noErrors @@ -43,10 +43,4 @@ const { query } = wrapClaudeAgentSdk(claudeAgentSdk); for await (const message of query({ prompt: 'hi' })) { // ...traced } -``` - -#### Defined in - -[src/integrations/claudeAgentSdk.ts:209](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/claudeAgentSdk.ts#L209) - -___ +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx b/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx index 343ecc484e..d1c276417e 100644 --- a/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx @@ -3,28 +3,22 @@ title: "wrapGoogleGenAI" description: "TypeScript SDK reference" --- -# wrapGoogleGenAI +> **wrapGoogleGenAI**\<`T`\>(`googleGenAI`): `T` -▸ **wrapGoogleGenAI**\<`T`\>(`googleGenAI`): `T` +Defined in: [src/integrations/googleGenAI.ts:239](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleGenAI.ts#L239) -#### Type parameters +## Type Parameters -| Name | Type | -| :------ | :------ | -| `T` | extends `GoogleGenAIAPI` | +### T -#### Parameters +`T` *extends* `GoogleGenAIAPI` -| Name | Type | -| :------ | :------ | -| `googleGenAI` | `T` | +## Parameters -#### Returns +### googleGenAI `T` -#### Defined in +## Returns -[src/integrations/googleGenAI.ts:239](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleGenAI.ts#L239) - -___ +`T` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/wrapopenai.mdx b/weave/reference/typescript-sdk/functions/wrapopenai.mdx index 1e13998641..793727ce4b 100644 --- a/weave/reference/typescript-sdk/functions/wrapopenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapopenai.mdx @@ -3,29 +3,29 @@ title: "wrapOpenAI" description: "TypeScript SDK reference" --- -# wrapOpenAI +> **wrapOpenAI**\<`T`\>(`openai`): `T` -▸ **wrapOpenAI**\<`T`\>(`openai`): `T` +Defined in: [src/integrations/openai.ts:723](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.ts#L723) Wraps the OpenAI API to enable function tracing for OpenAI calls. -#### Type parameters +## Type Parameters -| Name | Type | -| :------ | :------ | -| `T` | extends `OpenAIAPI` | +### T -#### Parameters +`T` *extends* `OpenAIAPI` -| Name | Type | -| :------ | :------ | -| `openai` | `T` | +## Parameters -#### Returns +### openai `T` -`Example` +## Returns + +`T` + +## Example ```ts twoslash // @noErrors @@ -34,8 +34,4 @@ const result = await openai.chat.completions.create({ model: 'gpt-3.5-turbo', messages: [{ role: 'user', content: 'Hello, world!' }] }); -``` - -#### Defined in - -[src/integrations/openai.ts:723](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.ts#L723) \ No newline at end of file +``` \ 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 2b21a252e8..fc7397127b 100644 --- a/weave/reference/typescript-sdk/interfaces/callschema.mdx +++ b/weave/reference/typescript-sdk/interfaces/callschema.mdx @@ -3,324 +3,249 @@ title: "CallSchema" description: "TypeScript SDK reference" --- -CallSchema +Defined in: [src/generated/traceServerApi.ts:1847](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1847) -## Table of contents - -### Properties - -- [attributes](./callschema#attributes) -- [deleted\_at](./callschema#deleted_at) -- [display\_name](./callschema#display_name) -- [ended\_at](./callschema#ended_at) -- [exception](./callschema#exception) -- [expire\_at](./callschema#expire_at) -- [id](./callschema#id) -- [inputs](./callschema#inputs) -- [op\_name](./callschema#op_name) -- [output](./callschema#output) -- [parent\_id](./callschema#parent_id) -- [project\_id](./callschema#project_id) -- [started\_at](./callschema#started_at) -- [storage\_size\_bytes](./callschema#storage_size_bytes) -- [summary](./callschema#summary) -- [thread\_id](./callschema#thread_id) -- [total\_storage\_size\_bytes](./callschema#total_storage_size_bytes) -- [trace\_id](./callschema#trace_id) -- [turn\_id](./callschema#turn_id) -- [wb\_run\_id](./callschema#wb_run_id) -- [wb\_run\_step](./callschema#wb_run_step) -- [wb\_run\_step\_end](./callschema#wb_run_step_end) -- [wb\_user\_id](./callschema#wb_user_id) -- [wb\_username](./callschema#wb_username) +CallSchema ## Properties ### attributes -• **attributes**: `Record`\<`string`, `any`\> +> **attributes**: `Record`\<`string`, `any`\> -Attributes +Defined in: [src/generated/traceServerApi.ts:1870](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1870) -#### Defined in +Attributes -[src/generated/traceServerApi.ts:1870](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1870) +*** -___ +### deleted\_at? -### deleted\_at +> `optional` **deleted\_at?**: `string` \| `null` -• `Optional` **deleted\_at**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1891](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1891) Deleted At -#### Defined in - -[src/generated/traceServerApi.ts:1891](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1891) +*** -___ +### display\_name? -### display\_name +> `optional` **display\_name?**: `string` \| `null` -• `Optional` **display\_name**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1855](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1855) Display Name -#### Defined in +*** -[src/generated/traceServerApi.ts:1855](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1855) +### ended\_at? -___ +> `optional` **ended\_at?**: `string` \| `null` -### ended\_at - -• `Optional` **ended\_at**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1874](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1874) Ended At -#### Defined in - -[src/generated/traceServerApi.ts:1874](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1874) +*** -___ +### exception? -### exception +> `optional` **exception?**: `string` \| `null` -• `Optional` **exception**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1876](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1876) Exception -#### Defined in - -[src/generated/traceServerApi.ts:1876](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1876) +*** -___ +### expire\_at? -### expire\_at +> `optional` **expire\_at?**: `string` \| `null` -• `Optional` **expire\_at**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1896](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1896) Expire At Expiration timestamp for this call. None = no TTL configured for the project (the row will not be expired). -#### Defined in - -[src/generated/traceServerApi.ts:1896](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1896) - -___ +*** ### id -• **id**: `string` +> **id**: `string` -Id - -#### Defined in +Defined in: [src/generated/traceServerApi.ts:1849](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1849) -[src/generated/traceServerApi.ts:1849](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1849) +Id -___ +*** ### inputs -• **inputs**: `Record`\<`string`, `any`\> - -Inputs +> **inputs**: `Record`\<`string`, `any`\> -#### Defined in +Defined in: [src/generated/traceServerApi.ts:1872](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1872) -[src/generated/traceServerApi.ts:1872](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1872) +Inputs -___ +*** ### op\_name -• **op\_name**: `string` +> **op\_name**: `string` -Op Name +Defined in: [src/generated/traceServerApi.ts:1853](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1853) -#### Defined in +Op Name -[src/generated/traceServerApi.ts:1853](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1853) +*** -___ +### output? -### output +> `optional` **output?**: `null` -• `Optional` **output**: ``null`` +Defined in: [src/generated/traceServerApi.ts:1878](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1878) Output -#### Defined in +*** -[src/generated/traceServerApi.ts:1878](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1878) +### parent\_id? -___ +> `optional` **parent\_id?**: `string` \| `null` -### parent\_id - -• `Optional` **parent\_id**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1859](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1859) Parent Id -#### Defined in - -[src/generated/traceServerApi.ts:1859](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1859) - -___ +*** ### project\_id -• **project\_id**: `string` - -Project Id +> **project\_id**: `string` -#### Defined in +Defined in: [src/generated/traceServerApi.ts:1851](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1851) -[src/generated/traceServerApi.ts:1851](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1851) +Project Id -___ +*** ### started\_at -• **started\_at**: `string` +> **started\_at**: `string` + +Defined in: [src/generated/traceServerApi.ts:1868](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1868) Started At -`Format` +#### Format date-time -#### Defined in +*** -[src/generated/traceServerApi.ts:1868](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1868) +### storage\_size\_bytes? -___ +> `optional` **storage\_size\_bytes?**: `number` \| `null` -### storage\_size\_bytes - -• `Optional` **storage\_size\_bytes**: ``null`` \| `number` +Defined in: [src/generated/traceServerApi.ts:1898](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1898) Storage Size Bytes -#### Defined in - -[src/generated/traceServerApi.ts:1898](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1898) - -___ +*** -### summary +### summary? -• `Optional` **summary**: `Record`\<`string`, `any`\> +> `optional` **summary?**: `Record`\<`string`, `any`\> -#### Defined in +Defined in: [src/generated/traceServerApi.ts:1879](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1879) -[src/generated/traceServerApi.ts:1879](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1879) +*** -___ +### thread\_id? -### thread\_id +> `optional` **thread\_id?**: `string` \| `null` -• `Optional` **thread\_id**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1861](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1861) Thread Id -#### Defined in +*** -[src/generated/traceServerApi.ts:1861](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1861) +### total\_storage\_size\_bytes? -___ +> `optional` **total\_storage\_size\_bytes?**: `number` \| `null` -### total\_storage\_size\_bytes - -• `Optional` **total\_storage\_size\_bytes**: ``null`` \| `number` +Defined in: [src/generated/traceServerApi.ts:1900](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1900) Total Storage Size Bytes -#### Defined in - -[src/generated/traceServerApi.ts:1900](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1900) - -___ +*** ### trace\_id -• **trace\_id**: `string` +> **trace\_id**: `string` -Trace Id +Defined in: [src/generated/traceServerApi.ts:1857](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1857) -#### Defined in +Trace Id -[src/generated/traceServerApi.ts:1857](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1857) +*** -___ +### turn\_id? -### turn\_id +> `optional` **turn\_id?**: `string` \| `null` -• `Optional` **turn\_id**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1863](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1863) Turn Id -#### Defined in +*** -[src/generated/traceServerApi.ts:1863](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1863) +### wb\_run\_id? -___ +> `optional` **wb\_run\_id?**: `string` \| `null` -### wb\_run\_id - -• `Optional` **wb\_run\_id**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1885](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1885) Wb Run Id -#### Defined in - -[src/generated/traceServerApi.ts:1885](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1885) +*** -___ +### wb\_run\_step? -### wb\_run\_step +> `optional` **wb\_run\_step?**: `number` \| `null` -• `Optional` **wb\_run\_step**: ``null`` \| `number` +Defined in: [src/generated/traceServerApi.ts:1887](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1887) Wb Run Step -#### Defined in +*** -[src/generated/traceServerApi.ts:1887](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1887) +### wb\_run\_step\_end? -___ +> `optional` **wb\_run\_step\_end?**: `number` \| `null` -### wb\_run\_step\_end - -• `Optional` **wb\_run\_step\_end**: ``null`` \| `number` +Defined in: [src/generated/traceServerApi.ts:1889](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1889) Wb Run Step End -#### Defined in - -[src/generated/traceServerApi.ts:1889](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1889) +*** -___ +### wb\_user\_id? -### wb\_user\_id +> `optional` **wb\_user\_id?**: `string` \| `null` -• `Optional` **wb\_user\_id**: ``null`` \| `string` +Defined in: [src/generated/traceServerApi.ts:1881](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1881) Wb User Id -#### Defined in - -[src/generated/traceServerApi.ts:1881](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1881) - -___ - -### wb\_username +*** -• `Optional` **wb\_username**: ``null`` \| `string` +### wb\_username? -Wb Username +> `optional` **wb\_username?**: `string` \| `null` -#### Defined in +Defined in: [src/generated/traceServerApi.ts:1883](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1883) -[src/generated/traceServerApi.ts:1883](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1883) \ No newline at end of file +Wb Username \ 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 eb23c07fd5..fda5c8d63f 100644 --- a/weave/reference/typescript-sdk/interfaces/callsfilter.mdx +++ b/weave/reference/typescript-sdk/interfaces/callsfilter.mdx @@ -3,152 +3,116 @@ title: "CallsFilter" description: "TypeScript SDK reference" --- -CallsFilter - -## Table of contents - -### Properties +Defined in: [src/generated/traceServerApi.ts:2040](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2040) -- [call\_ids](./callsfilter#call_ids) -- [input\_refs](./callsfilter#input_refs) -- [op\_names](./callsfilter#op_names) -- [output\_refs](./callsfilter#output_refs) -- [parent\_ids](./callsfilter#parent_ids) -- [thread\_ids](./callsfilter#thread_ids) -- [trace\_ids](./callsfilter#trace_ids) -- [trace\_roots\_only](./callsfilter#trace_roots_only) -- [turn\_ids](./callsfilter#turn_ids) -- [wb\_run\_ids](./callsfilter#wb_run_ids) -- [wb\_user\_ids](./callsfilter#wb_user_ids) +CallsFilter ## Properties -### call\_ids +### call\_ids? -• `Optional` **call\_ids**: ``null`` \| `string`[] +> `optional` **call\_ids?**: `string`[] \| `null` -Call Ids +Defined in: [src/generated/traceServerApi.ts:2052](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2052) -#### Defined in +Call Ids -[src/generated/traceServerApi.ts:2052](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2052) +*** -___ +### input\_refs? -### input\_refs +> `optional` **input\_refs?**: `string`[] \| `null` -• `Optional` **input\_refs**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2044](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2044) Input Refs -#### Defined in - -[src/generated/traceServerApi.ts:2044](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2044) +*** -___ +### op\_names? -### op\_names +> `optional` **op\_names?**: `string`[] \| `null` -• `Optional` **op\_names**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2042](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2042) Op Names -#### Defined in +*** -[src/generated/traceServerApi.ts:2042](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2042) +### output\_refs? -___ +> `optional` **output\_refs?**: `string`[] \| `null` -### output\_refs - -• `Optional` **output\_refs**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2046](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2046) Output Refs -#### Defined in - -[src/generated/traceServerApi.ts:2046](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2046) +*** -___ +### parent\_ids? -### parent\_ids +> `optional` **parent\_ids?**: `string`[] \| `null` -• `Optional` **parent\_ids**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2048](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2048) Parent Ids -#### Defined in +*** -[src/generated/traceServerApi.ts:2048](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2048) +### thread\_ids? -___ +> `optional` **thread\_ids?**: `string`[] \| `null` -### thread\_ids - -• `Optional` **thread\_ids**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2054](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2054) Thread Ids -#### Defined in - -[src/generated/traceServerApi.ts:2054](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2054) +*** -___ +### trace\_ids? -### trace\_ids +> `optional` **trace\_ids?**: `string`[] \| `null` -• `Optional` **trace\_ids**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2050](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2050) Trace Ids -#### Defined in +*** -[src/generated/traceServerApi.ts:2050](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2050) +### trace\_roots\_only? -___ +> `optional` **trace\_roots\_only?**: `boolean` \| `null` -### trace\_roots\_only - -• `Optional` **trace\_roots\_only**: ``null`` \| `boolean` +Defined in: [src/generated/traceServerApi.ts:2058](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2058) Trace Roots Only -#### Defined in - -[src/generated/traceServerApi.ts:2058](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2058) +*** -___ +### turn\_ids? -### turn\_ids +> `optional` **turn\_ids?**: `string`[] \| `null` -• `Optional` **turn\_ids**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2056](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2056) Turn Ids -#### Defined in +*** -[src/generated/traceServerApi.ts:2056](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2056) +### wb\_run\_ids? -___ +> `optional` **wb\_run\_ids?**: `string`[] \| `null` -### wb\_run\_ids - -• `Optional` **wb\_run\_ids**: ``null`` \| `string`[] +Defined in: [src/generated/traceServerApi.ts:2062](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2062) Wb Run Ids -#### Defined in - -[src/generated/traceServerApi.ts:2062](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2062) - -___ - -### wb\_user\_ids +*** -• `Optional` **wb\_user\_ids**: ``null`` \| `string`[] +### wb\_user\_ids? -Wb User Ids +> `optional` **wb\_user\_ids?**: `string`[] \| `null` -#### Defined in +Defined in: [src/generated/traceServerApi.ts:2060](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2060) -[src/generated/traceServerApi.ts:2060](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2060) \ No newline at end of file +Wb User Ids \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/conversation.mdx b/weave/reference/typescript-sdk/interfaces/conversation.mdx new file mode 100644 index 0000000000..81483ffd74 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/conversation.mdx @@ -0,0 +1,145 @@ +--- +title: "Conversation" +description: "TypeScript SDK reference" +--- + +Defined in: [src/genai/conversation.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L72) + +A Conversation groups Turns under a single `gen_ai.conversation.id`. It is +not itself an OTel span — children stamp the conversation id onto theirs. + +## Accessors + +### agentName + +#### Get Signature + +> **get** **agentName**(): `string` + +Defined in: [src/genai/conversation.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L94) + +##### Returns + +`string` + +*** + +### attributes + +#### Get Signature + +> **get** **attributes**(): `Attributes` + +Defined in: [src/genai/conversation.ts:106](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L106) + +##### Returns + +`Attributes` + +*** + +### conversationId + +#### Get Signature + +> **get** **conversationId**(): `string` + +Defined in: [src/genai/conversation.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L102) + +##### Returns + +`string` + +*** + +### model + +#### Get Signature + +> **get** **model**(): `string` + +Defined in: [src/genai/conversation.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L98) + +##### Returns + +`string` + +*** + +### sessionId + + + **Deprecated.** Use [Conversation.conversationId](#conversationid) instead. + + +#### Get Signature + +> **get** **sessionId**(): `string` + +Defined in: [src/genai/conversation.ts:111](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L111) + +##### Returns + +`string` + +## Methods + +### end() + +> **end**(`opts?`): `void` + +Defined in: [src/genai/conversation.ts:168](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L168) + +#### Parameters + +##### opts? + +`SpanEndOptions` + +#### Returns + +`void` + +*** + +### startTurn() + +> **startTurn**(`opts?`): [`Turn`](./turn) + +Defined in: [src/genai/conversation.ts:156](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L156) + +Start a new `Turn` under this `Conversation`. The turn inherits the +conversation's `conversationId`; `agentName`, `agentId`, `agentDescription`, +`agentVersion` and `model` fall back to the conversation's values when not +provided on `opts`. + +#### Parameters + +##### opts? + +[`TurnInit`](./turninit) = `{}` + +#### Returns + +[`Turn`](./turn) + +#### Examples + +```ts twoslash +// @noErrors +const turn = conversation.startTurn(); +``` + +```ts twoslash +// @noErrors +const turn = conversation.startTurn({ + model: 'gpt-4o', + agentName: 'research-bot', + agentId: 'research-bot-prod', + agentDescription: 'Looks up facts on Wikipedia.', + agentVersion: '1.4.2', + userMessage: 'What is the weather in Tokyo?', + systemInstructions: ['You are a helpful weather bot.'], + startTime: new Date('2026-05-29T10:00:00.000Z'), +}); +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/conversationinit.mdx b/weave/reference/typescript-sdk/interfaces/conversationinit.mdx index 0721d269a6..66ea46e1c3 100644 --- a/weave/reference/typescript-sdk/interfaces/conversationinit.mdx +++ b/weave/reference/typescript-sdk/interfaces/conversationinit.mdx @@ -3,124 +3,97 @@ title: "ConversationInit" description: "TypeScript SDK reference" --- -## Table of contents - -### Properties - -- [agentDescription](./conversationinit#agentdescription) -- [agentId](./conversationinit#agentid) -- [agentName](./conversationinit#agentname) -- [agentVersion](./conversationinit#agentversion) -- [attributes](./conversationinit#attributes) -- [conversationId](./conversationinit#conversationid) -- [model](./conversationinit#model) -- [sessionId](./conversationinit#sessionid) +Defined in: [src/genai/conversation.ts:8](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L8) ## Properties -### agentDescription +### agentDescription? + +> `optional` **agentDescription?**: `string` -• `Optional` **agentDescription**: `string` +Defined in: [src/genai/conversation.ts:31](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L31) Human-readable agent description. Propagated as the default `agentDescription` to every `Turn` created via `startTurn()` unless the turn sets its own; emitted on each turn's `invoke_agent` span as `gen_ai.agent.description`. -#### Defined in +*** -[src/genai/conversation.ts:31](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L31) +### agentId? -___ +> `optional` **agentId?**: `string` -### agentId - -• `Optional` **agentId**: `string` +Defined in: [src/genai/conversation.ts:16](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L16) Stable agent identifier. Propagated as the default `agentId` to every `Turn` created via `startTurn()` unless the turn sets its own; emitted on each turn's `invoke_agent` span as `gen_ai.agent.id`. -#### Defined in - -[src/genai/conversation.ts:16](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L16) +*** -___ +### agentName? -### agentName +> `optional` **agentName?**: `string` -• `Optional` **agentName**: `string` +Defined in: [src/genai/conversation.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L23) Agent name. Propagated as the default `agentName` to every `Turn` created via `startTurn()` unless the turn sets its own; emitted on each turn's `invoke_agent` span as `gen_ai.agent.name`. -#### Defined in - -[src/genai/conversation.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L23) +*** -___ +### agentVersion? -### agentVersion +> `optional` **agentVersion?**: `string` -• `Optional` **agentVersion**: `string` +Defined in: [src/genai/conversation.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L38) Agent version string. Propagated as the default `agentVersion` to every `Turn` created via `startTurn()` unless the turn sets its own; emitted on each turn's `invoke_agent` span as `gen_ai.agent.version`. -#### Defined in +*** -[src/genai/conversation.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L38) +### attributes? -___ +> `optional` **attributes?**: `Attributes` -### attributes - -• `Optional` **attributes**: `Attributes` +Defined in: [src/genai/conversation.ts:52](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L52) Custom attributes stamped on every span the conversation emits. A key here that collides with a span's own `gen_ai.*` / `weave.*` attribute is unsupported; the span's value wins. -#### Defined in - -[src/genai/conversation.ts:52](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L52) +*** -___ +### conversationId? -### conversationId +> `optional` **conversationId?**: `string` -• `Optional` **conversationId**: `string` +Defined in: [src/genai/conversation.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L44) Conversation ID propagated to every span under this conversation as `gen_ai.conversation.id`. Auto-generated if omitted. -#### Defined in - -[src/genai/conversation.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L44) +*** -___ +### model? -### model +> `optional` **model?**: `string` -• `Optional` **model**: `string` +Defined in: [src/genai/conversation.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L9) -#### Defined in +*** -[src/genai/conversation.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L9) - -___ - -### sessionId +### ~~sessionId?~~ - **Deprecated.** Use [ConversationInit.conversationId](./conversationinit#conversationid) instead. + **Deprecated.** Use [ConversationInit.conversationId](#conversationid) instead. -• `Optional` **sessionId**: `string` - -#### Defined in +> `optional` **sessionId?**: `string` -[src/genai/conversation.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L55) \ No newline at end of file +Defined in: [src/genai/conversation.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L55) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getagentsoptions.mdx b/weave/reference/typescript-sdk/interfaces/getagentsoptions.mdx index e496db7282..b9d51dab2b 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentsoptions.mdx @@ -3,53 +3,38 @@ title: "GetAgentsOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgents](../classes/weaveclient#getagents). +Defined in: [src/weaveClient.ts:115](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L115) -## Table of contents - -### Properties - -- [agentName](./getagentsoptions#agentname) -- [limit](./getagentsoptions#limit) -- [offset](./getagentsoptions#offset) -- [sortBy](./getagentsoptions#sortby) +Options for [WeaveClient.getAgents](./weaveclient#getagents). ## Properties -### agentName - -• `Optional` **agentName**: `string` - -#### Defined in - -[src/weaveClient.ts:116](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L116) - -___ +### agentName? -### limit +> `optional` **agentName?**: `string` -• `Optional` **limit**: `number` +Defined in: [src/weaveClient.ts:116](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L116) -#### Defined in +*** -[src/weaveClient.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L117) +### limit? -___ +> `optional` **limit?**: `number` -### offset +Defined in: [src/weaveClient.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L117) -• `Optional` **offset**: `number` +*** -#### Defined in +### offset? -[src/weaveClient.ts:118](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L118) +> `optional` **offset?**: `number` -___ +Defined in: [src/weaveClient.ts:118](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L118) -### sortBy +*** -• `Optional` **sortBy**: [`SortBy`](./sortby)[] +### sortBy? -#### Defined in +> `optional` **sortBy?**: [`SortBy`](./sortby)[] -[src/weaveClient.ts:119](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L119) \ No newline at end of file +Defined in: [src/weaveClient.ts:119](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L119) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getagentspansoptions.mdx b/weave/reference/typescript-sdk/interfaces/getagentspansoptions.mdx index c2ef056d33..f3e46f006b 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentspansoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentspansoptions.mdx @@ -3,92 +3,74 @@ title: "GetAgentSpansOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentSpans](../classes/weaveclient#getagentspans). +Defined in: [src/weaveClient.ts:160](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L160) -## Table of contents - -### Properties - -- [agentName](./getagentspansoptions#agentname) -- [limit](./getagentspansoptions#limit) -- [offset](./getagentspansoptions#offset) -- [query](./getagentspansoptions#query) -- [sortBy](./getagentspansoptions#sortby) +Options for [WeaveClient.getAgentSpans](./weaveclient#getagentspans). ## Properties -### agentName +### agentName? -• `Optional` **agentName**: `string` +> `optional` **agentName?**: `string` -#### Defined in +Defined in: [src/weaveClient.ts:161](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L161) -[src/weaveClient.ts:161](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L161) +*** -___ +### limit? -### limit +> `optional` **limit?**: `number` -• `Optional` **limit**: `number` +Defined in: [src/weaveClient.ts:171](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L171) -`Min` +#### Min 0 -`Max` +#### Max 10000 -`Default` +#### Default ```ts twoslash // @noErrors 100 ``` -#### Defined in +*** -[src/weaveClient.ts:171](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L171) +### offset? -___ +> `optional` **offset?**: `number` -### offset +Defined in: [src/weaveClient.ts:176](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L176) -• `Optional` **offset**: `number` - -`Min` +#### Min 0 -`Default` +#### Default ```ts twoslash // @noErrors 0 ``` -#### Defined in - -[src/weaveClient.ts:176](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L176) +*** -___ +### query? -### query +> `optional` **query?**: [`Query`](./query) \| `null` -• `Optional` **query**: ``null`` \| [`Query`](./query) +Defined in: [src/weaveClient.ts:165](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L165) Mongo-style filter on the spans. -#### Defined in - -[src/weaveClient.ts:165](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L165) - -___ - -### sortBy +*** -• `Optional` **sortBy**: [`SortBy`](./sortby)[] +### sortBy? -#### Defined in +> `optional` **sortBy?**: [`SortBy`](./sortby)[] -[src/weaveClient.ts:177](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L177) \ No newline at end of file +Defined in: [src/weaveClient.ts:177](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L177) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getagentturnoptions.mdx b/weave/reference/typescript-sdk/interfaces/getagentturnoptions.mdx index 68600a6599..c05f651294 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentturnoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentturnoptions.mdx @@ -3,31 +3,22 @@ title: "GetAgentTurnOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentTurn](../classes/weaveclient#getagentturn). +Defined in: [src/weaveClient.ts:220](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L220) -## Table of contents - -### Properties - -- [includeFeedback](./getagentturnoptions#includefeedback) -- [traceId](./getagentturnoptions#traceid) +Options for [WeaveClient.getAgentTurn](./weaveclient#getagentturn). ## Properties -### includeFeedback +### includeFeedback? -• `Optional` **includeFeedback**: `boolean` +> `optional` **includeFeedback?**: `boolean` -#### Defined in +Defined in: [src/weaveClient.ts:222](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L222) -[src/weaveClient.ts:222](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L222) - -___ +*** ### traceId -• **traceId**: `string` - -#### Defined in +> **traceId**: `string` -[src/weaveClient.ts:221](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L221) \ No newline at end of file +Defined in: [src/weaveClient.ts:221](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L221) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getagentturnsoptions.mdx b/weave/reference/typescript-sdk/interfaces/getagentturnsoptions.mdx index 0763b362f4..8dd048e1c3 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentturnsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentturnsoptions.mdx @@ -3,79 +3,64 @@ title: "GetAgentTurnsOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentTurns](../classes/weaveclient#getagentturns). +Defined in: [src/weaveClient.ts:233](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L233) -## Table of contents - -### Properties - -- [conversationId](./getagentturnsoptions#conversationid) -- [includeFeedback](./getagentturnsoptions#includefeedback) -- [limit](./getagentturnsoptions#limit) -- [offset](./getagentturnsoptions#offset) +Options for [WeaveClient.getAgentTurns](./weaveclient#getagentturns). ## Properties ### conversationId -• **conversationId**: `string` +> **conversationId**: `string` -#### Defined in +Defined in: [src/weaveClient.ts:234](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L234) -[src/weaveClient.ts:234](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L234) +*** -___ +### includeFeedback? -### includeFeedback +> `optional` **includeFeedback?**: `boolean` -• `Optional` **includeFeedback**: `boolean` +Defined in: [src/weaveClient.ts:246](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L246) -#### Defined in +*** -[src/weaveClient.ts:246](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L246) +### limit? -___ +> `optional` **limit?**: `number` -### limit +Defined in: [src/weaveClient.ts:240](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L240) -• `Optional` **limit**: `number` - -`Min` +#### Min 0 -`Max` +#### Max 50 -`Default` +#### Default ```ts twoslash // @noErrors 50 ``` -#### Defined in - -[src/weaveClient.ts:240](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L240) +*** -___ +### offset? -### offset +> `optional` **offset?**: `number` -• `Optional` **offset**: `number` +Defined in: [src/weaveClient.ts:245](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L245) -`Min` +#### Min 0 -`Default` +#### Default ```ts twoslash // @noErrors 0 -``` - -#### Defined in - -[src/weaveClient.ts:245](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L245) \ No newline at end of file +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx b/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx index 761d8b4a00..88eaa236a2 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx @@ -3,79 +3,64 @@ title: "GetAgentVersionsOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentVersions](../classes/weaveclient#getagentversions). +Defined in: [src/weaveClient.ts:133](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L133) -## Table of contents - -### Properties - -- [agentName](./getagentversionsoptions#agentname) -- [limit](./getagentversionsoptions#limit) -- [offset](./getagentversionsoptions#offset) -- [sortBy](./getagentversionsoptions#sortby) +Options for [WeaveClient.getAgentVersions](./weaveclient#getagentversions). ## Properties ### agentName -• **agentName**: `string` +> **agentName**: `string` -#### Defined in +Defined in: [src/weaveClient.ts:134](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L134) -[src/weaveClient.ts:134](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L134) +*** -___ +### limit? -### limit +> `optional` **limit?**: `number` -• `Optional` **limit**: `number` +Defined in: [src/weaveClient.ts:140](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L140) -`Min` +#### Min 0 -`Max` +#### Max 10000 -`Default` +#### Default ```ts twoslash // @noErrors 100 ``` -#### Defined in - -[src/weaveClient.ts:140](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L140) +*** -___ +### offset? -### offset +> `optional` **offset?**: `number` -• `Optional` **offset**: `number` +Defined in: [src/weaveClient.ts:145](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L145) -`Min` +#### Min 0 -`Default` +#### Default ```ts twoslash // @noErrors 0 ``` -#### Defined in - -[src/weaveClient.ts:145](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L145) - -___ - -### sortBy +*** -• `Optional` **sortBy**: [`SortBy`](./sortby)[] +### sortBy? -#### Defined in +> `optional` **sortBy?**: [`SortBy`](./sortby)[] -[src/weaveClient.ts:146](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L146) \ No newline at end of file +Defined in: [src/weaveClient.ts:146](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L146) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx b/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx index b052bf7dea..b52d2b7a81 100644 --- a/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx @@ -3,106 +3,76 @@ title: "GetCallsOptions" description: "TypeScript SDK reference" --- -## 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) +Defined in: [src/weaveClient.ts:93](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L93) ## Properties -### columns - -• `Optional` **columns**: `string`[] - -#### Defined in - -[src/weaveClient.ts:101](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L101) - -___ - -### expandColumns - -• `Optional` **expandColumns**: `string`[] - -#### Defined in - -[src/weaveClient.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L102) - -___ +### columns? -### filter +> `optional` **columns?**: `string`[] -• `Optional` **filter**: [`CallsFilter`](./callsfilter) +Defined in: [src/weaveClient.ts:101](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L101) -#### Defined in +*** -[src/weaveClient.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L94) +### expandColumns? -___ +> `optional` **expandColumns?**: `string`[] -### includeCosts +Defined in: [src/weaveClient.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L102) -• `Optional` **includeCosts**: `boolean` +*** -#### Defined in +### filter? -[src/weaveClient.ts:96](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L96) +> `optional` **filter?**: [`CallsFilter`](./callsfilter) -___ +Defined in: [src/weaveClient.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L94) -### includeFeedback +*** -• `Optional` **includeFeedback**: `boolean` +### includeCosts? -#### Defined in +> `optional` **includeCosts?**: `boolean` -[src/weaveClient.ts:97](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L97) +Defined in: [src/weaveClient.ts:96](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L96) -___ +*** -### limit +### includeFeedback? -• `Optional` **limit**: `number` +> `optional` **includeFeedback?**: `boolean` -#### Defined in +Defined in: [src/weaveClient.ts:97](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L97) -[src/weaveClient.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L98) +*** -___ +### limit? -### offset +> `optional` **limit?**: `number` -• `Optional` **offset**: `number` +Defined in: [src/weaveClient.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L98) -#### Defined in +*** -[src/weaveClient.ts:99](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L99) +### offset? -___ +> `optional` **offset?**: `number` -### query +Defined in: [src/weaveClient.ts:99](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L99) -• `Optional` **query**: [`Query`](./query) +*** -#### Defined in +### query? -[src/weaveClient.ts:95](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L95) +> `optional` **query?**: [`Query`](./query) -___ +Defined in: [src/weaveClient.ts:95](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L95) -### sortBy +*** -• `Optional` **sortBy**: [`SortBy`](./sortby)[] +### sortBy? -#### Defined in +> `optional` **sortBy?**: [`SortBy`](./sortby)[] -[src/weaveClient.ts:100](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L100) \ No newline at end of file +Defined in: [src/weaveClient.ts:100](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L100) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/httpresponse.mdx b/weave/reference/typescript-sdk/interfaces/httpresponse.mdx index 49844c25b3..b17e2f853b 100644 --- a/weave/reference/typescript-sdk/interfaces/httpresponse.mdx +++ b/weave/reference/typescript-sdk/interfaces/httpresponse.mdx @@ -3,102 +3,73 @@ title: "HttpResponse" description: "TypeScript SDK reference" --- -## Type parameters +Defined in: [src/generated/traceServerApi.ts:5989](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5989) -| Name | Type | -| :------ | :------ | -| `D` | extends `unknown` | -| `E` | extends `unknown` = `unknown` | - -## Hierarchy +## Extends - `Response` - ↳ `HttpResponse` - -## Table of contents +## Type Parameters -### Properties +### D -- [body](./httpresponse#body) -- [bodyUsed](./httpresponse#bodyused) -- [data](./httpresponse#data) -- [error](./httpresponse#error) -- [headers](./httpresponse#headers) -- [ok](./httpresponse#ok) -- [redirected](./httpresponse#redirected) -- [status](./httpresponse#status) -- [statusText](./httpresponse#statustext) -- [type](./httpresponse#type) -- [url](./httpresponse#url) +`D` *extends* `unknown` -### Methods +### E -- [arrayBuffer](./httpresponse#arraybuffer) -- [blob](./httpresponse#blob) -- [bytes](./httpresponse#bytes) -- [clone](./httpresponse#clone) -- [formData](./httpresponse#formdata) -- [json](./httpresponse#json) -- [text](./httpresponse#text) +`E` *extends* `unknown` = `unknown` ## Properties ### body -• `Readonly` **body**: ``null`` \| `ReadableStream`\<`Uint8Array`\<`ArrayBuffer`\>\> +> `readonly` **body**: `ReadableStream`\<`Uint8Array`\<`ArrayBuffer`\>\> \| `null` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4468 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) #### Inherited from -Response.body - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:4468 +`Response.body` -___ +*** ### bodyUsed -• `Readonly` **bodyUsed**: `boolean` +> `readonly` **bodyUsed**: `boolean` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4470 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) #### Inherited from -Response.bodyUsed - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:4470 +`Response.bodyUsed` -___ +*** ### data -• **data**: `D` +> **data**: `D` -#### Defined in +Defined in: [src/generated/traceServerApi.ts:5991](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5991) -[src/generated/traceServerApi.ts:5991](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5991) - -___ +*** ### error -• **error**: `E` - -#### Defined in +> **error**: `E` -[src/generated/traceServerApi.ts:5992](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5992) +Defined in: [src/generated/traceServerApi.ts:5992](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5992) -___ +*** ### headers -• `Readonly` **headers**: `Headers` +> `readonly` **headers**: `Headers` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26322 The `headers` read-only property of the with the response. @@ -106,17 +77,15 @@ The `headers` read-only property of the with the response. #### Inherited from -Response.headers - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:26322 +`Response.headers` -___ +*** ### ok -• `Readonly` **ok**: `boolean` +> `readonly` **ok**: `boolean` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26328 The `ok` read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not. @@ -124,17 +93,15 @@ The `ok` read-only property of the Response interface contains a Boolean stating #### Inherited from -Response.ok - -#### Defined in +`Response.ok` -node_modules/typescript/lib/lib.dom.d.ts:26328 - -___ +*** ### redirected -• `Readonly` **redirected**: `boolean` +> `readonly` **redirected**: `boolean` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26334 The `redirected` read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected. @@ -142,17 +109,15 @@ The `redirected` read-only property of the Response interface indicates whether #### Inherited from -Response.redirected - -#### Defined in +`Response.redirected` -node_modules/typescript/lib/lib.dom.d.ts:26334 - -___ +*** ### status -• `Readonly` **status**: `number` +> `readonly` **status**: `number` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26340 The `status` read-only property of the Response interface contains the HTTP status codes of the response. @@ -160,17 +125,15 @@ The `status` read-only property of the Response interface contains the HTTP stat #### Inherited from -Response.status +`Response.status` -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:26340 - -___ +*** ### statusText -• `Readonly` **statusText**: `string` +> `readonly` **statusText**: `string` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26346 The `statusText` read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status. @@ -178,17 +141,15 @@ The `statusText` read-only property of the Response interface contains the statu #### Inherited from -Response.statusText - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:26346 +`Response.statusText` -___ +*** ### type -• `Readonly` **type**: `ResponseType` +> `readonly` **type**: `ResponseType` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26352 The `type` read-only property of the Response interface contains the type of the response. @@ -196,17 +157,15 @@ The `type` read-only property of the Response interface contains the type of the #### Inherited from -Response.type - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:26352 +`Response.type` -___ +*** ### url -• `Readonly` **url**: `string` +> `readonly` **url**: `string` + +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26358 The `url` read-only property of the Response interface contains the URL of the response. @@ -214,17 +173,15 @@ The `url` read-only property of the Response interface contains the URL of the r #### Inherited from -Response.url - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:26358 +`Response.url` ## Methods -### arrayBuffer +### arrayBuffer() + +> **arrayBuffer**(): `Promise`\<`ArrayBuffer`\> -▸ **arrayBuffer**(): `Promise`\<`ArrayBuffer`\> +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4472 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) @@ -234,17 +191,15 @@ node_modules/typescript/lib/lib.dom.d.ts:26358 #### Inherited from -Response.arrayBuffer - -#### Defined in +`Response.arrayBuffer` -node_modules/typescript/lib/lib.dom.d.ts:4472 +*** -___ +### blob() -### blob +> **blob**(): `Promise`\<`Blob`\> -▸ **blob**(): `Promise`\<`Blob`\> +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4474 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) @@ -254,17 +209,15 @@ ___ #### Inherited from -Response.blob +`Response.blob` -#### Defined in +*** -node_modules/typescript/lib/lib.dom.d.ts:4474 +### bytes() -___ +> **bytes**(): `Promise`\<`Uint8Array`\<`ArrayBuffer`\>\> -### bytes - -▸ **bytes**(): `Promise`\<`Uint8Array`\<`ArrayBuffer`\>\> +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4476 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) @@ -274,17 +227,15 @@ ___ #### Inherited from -Response.bytes - -#### Defined in +`Response.bytes` -node_modules/typescript/lib/lib.dom.d.ts:4476 +*** -___ +### clone() -### clone +> **clone**(): `Response` -▸ **clone**(): `Response` +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26364 The `clone()` method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable. @@ -296,17 +247,15 @@ The `clone()` method of the Response interface creates a clone of a response obj #### Inherited from -Response.clone +`Response.clone` -#### Defined in +*** -node_modules/typescript/lib/lib.dom.d.ts:26364 +### formData() -___ +> **formData**(): `Promise`\<`FormData`\> -### formData - -▸ **formData**(): `Promise`\<`FormData`\> +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4478 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) @@ -316,17 +265,15 @@ ___ #### Inherited from -Response.formData - -#### Defined in +`Response.formData` -node_modules/typescript/lib/lib.dom.d.ts:4478 +*** -___ +### json() -### json +> **json**(): `Promise`\<`any`\> -▸ **json**(): `Promise`\<`any`\> +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4480 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) @@ -336,17 +283,15 @@ ___ #### Inherited from -Response.json - -#### Defined in +`Response.json` -node_modules/typescript/lib/lib.dom.d.ts:4480 +*** -___ +### text() -### text +> **text**(): `Promise`\<`string`\> -▸ **text**(): `Promise`\<`string`\> +Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4482 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) @@ -356,8 +301,4 @@ ___ #### Inherited from -Response.text - -#### Defined in - -node_modules/typescript/lib/lib.dom.d.ts:4482 \ No newline at end of file +`Response.text` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx b/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx index fe80820264..216fc254e3 100644 --- a/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx +++ b/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx @@ -3,22 +3,16 @@ title: "HTTPValidationError" description: "TypeScript SDK reference" --- -HTTPValidationError - -## Table of contents - -### Properties +Defined in: [src/generated/traceServerApi.ts:4075](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L4075) -- [detail](./httpvalidationerror#detail) +HTTPValidationError ## Properties -### detail - -• `Optional` **detail**: `ValidationError`[] +### detail? -Detail +> `optional` **detail?**: `ValidationError`[] -#### Defined in +Defined in: [src/generated/traceServerApi.ts:4077](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L4077) -[src/generated/traceServerApi.ts:4077](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L4077) \ No newline at end of file +Detail \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/llm.mdx b/weave/reference/typescript-sdk/interfaces/llm.mdx new file mode 100644 index 0000000000..ddd17beec6 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/llm.mdx @@ -0,0 +1,400 @@ +--- +title: "LLM" +description: "TypeScript SDK reference" +--- + +Defined in: [src/genai/llm.ts:86](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L86) + +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()`. + +## Examples + +```ts twoslash +// @noErrors +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(); +} +``` + +```ts twoslash +// @noErrors +const llm = weave.startLLM({ + model: 'gpt-4o-mini', + providerName: 'openai', + systemInstructions: ['You are a helpful weather bot.'], + startTime: new Date('2026-05-29T10:00:00.000Z'), +}); + +try { + // ... call the LLM, populate llm.outputMessages / usage ... +} finally { + llm.end(); +} +``` + +## Extends + +- `SpanBase` + +## Properties + +### inputMessages + +> **inputMessages**: [`Message`](./message)[] = `[]` + +Defined in: [src/genai/llm.ts:93](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L93) + +Input messages sent to the model. Flushed to `gen_ai.input.messages` on +`end()`. + +*** + +### model + +> `readonly` **model**: `string` + +Defined in: [src/genai/llm.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L117) + +*** + +### outputMessages + +> **outputMessages**: [`Message`](./message)[] = `[]` + +Defined in: [src/genai/llm.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L98) + +Assistant messages returned by the model. Flushed to +`gen_ai.output.messages` on `end()`. + +*** + +### providerName + +> `readonly` **providerName**: `string` + +Defined in: [src/genai/llm.ts:118](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L118) + +*** + +### reasoning? + +> `optional` **reasoning?**: [`Reasoning`](./reasoning) + +Defined in: [src/genai/llm.ts:105](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L105) + +Chain-of-thought content. Folded into the last assistant message as a +ReasoningPart at serialization time. + +*** + +### usage + +> **usage**: [`Usage`](./usage) = `{}` + +Defined in: [src/genai/llm.ts:100](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L100) + +Token counts and cache stats. Flushed to `gen_ai.usage.*` on `end()`. + +## Methods + +### ~~addEvent()~~ + + + **Deprecated.** Record this data via [setAttributes](#setattributes) instead. +OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This +method still works and existing span-event data stays valid. +See https://opentelemetry.io/blog/2026/deprecating-span-events/ + + +> **addEvent**(`name`, `attributes?`, `startTime?`): `this` + +Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) + +Add a named event to the span. Useful for marking non-span moments such as +context compaction, tool-loop detection, or guardrail trips. Warns and +no-ops after `end()`. Mirrors OTel `Span.addEvent`. + +#### Parameters + +##### name + +`string` + +##### attributes? + +`Attributes` + +##### startTime? + +`TimeInput` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.addEvent('context_compacted', {removedMessages: 12}); +``` + +#### Inherited from + +`SpanBase.addEvent` + +*** + +### attachMedia() + +> **attachMedia**(`opts`): `this` + +Defined in: [src/genai/llm.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L183) + +Stage a media attachment for the LLM call. Pick exactly one of + `content` (inline base64 bytes), `uri` (URI reference), or `fileId` + (pre-uploaded file id). The attachment is glued onto the last user + message in `inputMessages` on `end()`. + +#### Parameters + +##### opts + +`AttachMediaOpts` + +#### Returns + +`this` + +*** + +### attachMediaUrl() + +> **attachMediaUrl**(`url`, `opts`): `this` + +Defined in: [src/genai/llm.ts:192](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L192) + +Convenience for `attachMedia({uri, modality})`. + +#### Parameters + +##### url + +`string` + +##### opts + +###### modality + +[`Modality`](../type-aliases/modality) + +#### Returns + +`this` + +*** + +### end() + +> **end**(`opts?`): `void` + +Defined in: [src/genai/llm.ts:274](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L274) + +Flush accumulated state and close the span. Idempotent. Pass `error` to mark failed; pass `endTime` to backdate the close. + +#### Parameters + +##### opts? + +`SpanEndOptions` + +#### Returns + +`void` + +*** + +### output() + +> **output**(`content`): `this` + +Defined in: [src/genai/llm.ts:155](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L155) + +Append an assistant message to the response. + +#### Parameters + +##### content + +`string` + +#### Returns + +`this` + +*** + +### record() + +> **record**(`opts`): `this` + +Defined in: [src/genai/llm.ts:203](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L203) + +Bulk-set any subset of the mutable fields. Replaces (does not merge). +Useful for assigning everything at once after a provider call returns. + +#### Parameters + +##### opts + +###### finishReasons? + +`string`[] + +###### inputMessages? + +[`Message`](./message)[] + +###### mediaAttachments? + +`AttachMediaOpts`[] + +###### outputMessages? + +[`Message`](./message)[] + +###### outputType? + +`string` + +###### reasoning? + +[`Reasoning`](./reasoning) + +###### responseId? + +`string` + +###### responseModel? + +`string` + +###### usage? + +[`Usage`](./usage) + +#### Returns + +`this` + +*** + +### setAttributes() + +> **setAttributes**(`attributes`): `this` + +Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) + +Set multiple attributes on the span at once. Warns and no-ops after +`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's +`set_attributes`). + +#### Parameters + +##### attributes + +`Attributes` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); +``` + +#### Inherited from + +`SpanBase.setAttributes` + +*** + +### startSubagent() + +> **startSubagent**(`opts`): [`SubAgent`](./subagent) + +Defined in: [src/genai/llm.ts:261](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L261) + +Start a child SubAgent span nested under this LLM. + +#### Parameters + +##### opts + +[`SubAgentInit`](./subagentinit) + +#### Returns + +[`SubAgent`](./subagent) + +*** + +### startTool() + +> **startTool**(`opts`): [`Tool`](./tool) + +Defined in: [src/genai/llm.ts:252](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L252) + +Start a child Tool span nested under this LLM. + +#### Parameters + +##### opts + +[`ToolInit`](./toolinit) + +#### Returns + +[`Tool`](./tool) + +*** + +### think() + +> **think**(`content`): `this` + +Defined in: [src/genai/llm.ts:167](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L167) + +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 + +##### content + +`string` + +#### Returns + +`this` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/llminit.mdx b/weave/reference/typescript-sdk/interfaces/llminit.mdx index 892b97c754..d77026eba1 100644 --- a/weave/reference/typescript-sdk/interfaces/llminit.mdx +++ b/weave/reference/typescript-sdk/interfaces/llminit.mdx @@ -3,61 +3,44 @@ title: "LLMInit" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/genai/llm.ts:36](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L36) -- `SpanInitBase` - - ↳ `LLMInit` - -## Table of contents +## Extends -### Properties - -- [model](./llminit#model) -- [providerName](./llminit#providername) -- [startTime](./llminit#starttime) -- [systemInstructions](./llminit#systeminstructions) +- `SpanInitBase` ## Properties ### model -• **model**: `string` +> **model**: `string` -#### Defined in +Defined in: [src/genai/llm.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L37) -[src/genai/llm.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L37) +*** -___ +### providerName? -### providerName +> `optional` **providerName?**: `string` -• `Optional` **providerName**: `string` +Defined in: [src/genai/llm.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L38) -#### Defined in +*** -[src/genai/llm.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L38) +### startTime? -___ +> `optional` **startTime?**: `TimeInput` -### startTime - -• `Optional` **startTime**: `TimeInput` +Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) #### Inherited from -SpanInitBase.startTime - -#### Defined in - -[src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) - -___ +`SpanInitBase.startTime` -### systemInstructions +*** -• `Optional` **systemInstructions**: `string`[] +### systemInstructions? -#### Defined in +> `optional` **systemInstructions?**: `string`[] -[src/genai/llm.ts:39](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L39) \ No newline at end of file +Defined in: [src/genai/llm.ts:39](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L39) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/message.mdx b/weave/reference/typescript-sdk/interfaces/message.mdx index 73528ba627..958497f1cf 100644 --- a/weave/reference/typescript-sdk/interfaces/message.mdx +++ b/weave/reference/typescript-sdk/interfaces/message.mdx @@ -3,62 +3,44 @@ title: "Message" description: "TypeScript SDK reference" --- -## Table of contents - -### Properties - -- [content](./message#content) -- [parts](./message#parts) -- [role](./message#role) -- [toolCallId](./message#toolcallid) -- [toolName](./message#toolname) +Defined in: [src/genai/types.ts:15](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L15) ## Properties -### content - -• `Optional` **content**: `string` - -#### Defined in +### content? -[src/genai/types.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L17) +> `optional` **content?**: `string` -___ +Defined in: [src/genai/types.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L17) -### parts +*** -• `Optional` **parts**: [`MessagePart`](../#messagepart)[] +### parts? -#### Defined in +> `optional` **parts?**: [`MessagePart`](../type-aliases/messagepart)[] -[src/genai/types.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L20) +Defined in: [src/genai/types.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L20) -___ +*** ### role -• **role**: [`Role`](../#role) - -#### Defined in - -[src/genai/types.ts:16](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L16) - -___ +> **role**: [`Role`](../type-aliases/role) -### toolCallId +Defined in: [src/genai/types.ts:16](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L16) -• `Optional` **toolCallId**: `string` +*** -#### Defined in +### toolCallId? -[src/genai/types.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L18) +> `optional` **toolCallId?**: `string` -___ +Defined in: [src/genai/types.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L18) -### toolName +*** -• `Optional` **toolName**: `string` +### toolName? -#### Defined in +> `optional` **toolName?**: `string` -[src/genai/types.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L19) \ No newline at end of file +Defined in: [src/genai/types.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L19) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/query.mdx b/weave/reference/typescript-sdk/interfaces/query.mdx index 9ece97ec7b..3f7acc3325 100644 --- a/weave/reference/typescript-sdk/interfaces/query.mdx +++ b/weave/reference/typescript-sdk/interfaces/query.mdx @@ -3,22 +3,16 @@ title: "Query" description: "TypeScript SDK reference" --- -Query - -## Table of contents - -### Properties +Defined in: [src/generated/traceServerApi.ts:5222](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5222) -- [$expr](./query#$expr) +Query ## Properties ### $expr -• **$expr**: `AndOperation` \| `OrOperation` \| `NotOperation` \| `EqOperation` \| `GtOperation` \| `LtOperation` \| `GteOperation` \| `LteOperation` \| `InOperation` \| `ContainsOperation` - -$Expr +> **$expr**: `AndOperation` \| `OrOperation` \| `NotOperation` \| `EqOperation` \| `GtOperation` \| `LtOperation` \| `GteOperation` \| `LteOperation` \| `InOperation` \| `ContainsOperation` -#### Defined in +Defined in: [src/generated/traceServerApi.ts:5224](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5224) -[src/generated/traceServerApi.ts:5224](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5224) \ No newline at end of file +$Expr \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/reasoning.mdx b/weave/reference/typescript-sdk/interfaces/reasoning.mdx index 333458c587..c1a219fe8f 100644 --- a/weave/reference/typescript-sdk/interfaces/reasoning.mdx +++ b/weave/reference/typescript-sdk/interfaces/reasoning.mdx @@ -3,18 +3,12 @@ title: "Reasoning" description: "TypeScript SDK reference" --- -## Table of contents - -### Properties - -- [content](./reasoning#content) +Defined in: [src/genai/types.ts:45](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L45) ## Properties ### content -• **content**: `string` - -#### Defined in +> **content**: `string` -[src/genai/types.ts:46](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L46) \ No newline at end of file +Defined in: [src/genai/types.ts:46](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L46) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/sortby.mdx b/weave/reference/typescript-sdk/interfaces/sortby.mdx index 05e50a20ec..7f70934013 100644 --- a/weave/reference/typescript-sdk/interfaces/sortby.mdx +++ b/weave/reference/typescript-sdk/interfaces/sortby.mdx @@ -3,35 +3,26 @@ title: "SortBy" description: "TypeScript SDK reference" --- -SortBy - -## Table of contents +Defined in: [src/generated/traceServerApi.ts:5536](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5536) -### Properties - -- [direction](./sortby#direction) -- [field](./sortby#field) +SortBy ## Properties ### direction -• **direction**: ``"asc"`` \| ``"desc"`` +> **direction**: `"asc"` \| `"desc"` -Direction - -#### Defined in +Defined in: [src/generated/traceServerApi.ts:5540](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5540) -[src/generated/traceServerApi.ts:5540](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5540) +Direction -___ +*** ### field -• **field**: `string` - -Field +> **field**: `string` -#### Defined in +Defined in: [src/generated/traceServerApi.ts:5538](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5538) -[src/generated/traceServerApi.ts:5538](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5538) \ No newline at end of file +Field \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/subagent.mdx b/weave/reference/typescript-sdk/interfaces/subagent.mdx new file mode 100644 index 0000000000..011d154759 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/subagent.mdx @@ -0,0 +1,183 @@ +--- +title: "SubAgent" +description: "TypeScript SDK reference" +--- + +Defined in: [src/genai/subagent.ts:65](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L65) + +## Extends + +- `SpanBase` + +## Accessors + +### model + +#### Get Signature + +> **get** **model**(): `string` + +Defined in: [src/genai/subagent.ts:78](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L78) + +##### Returns + +`string` + +*** + +### name + +#### Get Signature + +> **get** **name**(): `string` + +Defined in: [src/genai/subagent.ts:74](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L74) + +##### Returns + +`string` + +## Methods + +### ~~addEvent()~~ + + + **Deprecated.** Record this data via [setAttributes](#setattributes) instead. +OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This +method still works and existing span-event data stays valid. +See https://opentelemetry.io/blog/2026/deprecating-span-events/ + + +> **addEvent**(`name`, `attributes?`, `startTime?`): `this` + +Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) + +Add a named event to the span. Useful for marking non-span moments such as +context compaction, tool-loop detection, or guardrail trips. Warns and +no-ops after `end()`. Mirrors OTel `Span.addEvent`. + +#### Parameters + +##### name + +`string` + +##### attributes? + +`Attributes` + +##### startTime? + +`TimeInput` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.addEvent('context_compacted', {removedMessages: 12}); +``` + +#### Inherited from + +`SpanBase.addEvent` + +*** + +### end() + +> **end**(`opts?`): `void` + +Defined in: [src/genai/subagent.ts:153](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L153) + +Read current field values (to reflect mutations made via `record()` +since `start`) and close the span. Idempotent. Pass `error` to mark +it as failed; pass `endTime` to backdate the close. + +#### Parameters + +##### opts? + +`SpanEndOptions` + +#### Returns + +`void` + +*** + +### record() + +> **record**(`opts`): `this` + +Defined in: [src/genai/subagent.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L117) + +Bulk-set any fields. Replaces (does not merge). + +#### Parameters + +##### opts + +###### agentDescription? + +`string` + +###### agentId? + +`string` + +###### agentVersion? + +`string` + +###### model? + +`string` + +###### name? + +`string` + +###### systemInstructions? + +`string`[] + +#### Returns + +`this` + +*** + +### setAttributes() + +> **setAttributes**(`attributes`): `this` + +Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) + +Set multiple attributes on the span at once. Warns and no-ops after +`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's +`set_attributes`). + +#### Parameters + +##### attributes + +`Attributes` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); +``` + +#### Inherited from + +`SpanBase.setAttributes` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/subagentinit.mdx b/weave/reference/typescript-sdk/interfaces/subagentinit.mdx index 27bdd20472..2052b31ece 100644 --- a/weave/reference/typescript-sdk/interfaces/subagentinit.mdx +++ b/weave/reference/typescript-sdk/interfaces/subagentinit.mdx @@ -3,94 +3,68 @@ title: "SubAgentInit" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/genai/subagent.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L19) -- `SpanInitBase` - - ↳ `SubAgentInit` - -## Table of contents +## Extends -### Properties - -- [agentDescription](./subagentinit#agentdescription) -- [agentId](./subagentinit#agentid) -- [agentVersion](./subagentinit#agentversion) -- [model](./subagentinit#model) -- [name](./subagentinit#name) -- [startTime](./subagentinit#starttime) -- [systemInstructions](./subagentinit#systeminstructions) +- `SpanInitBase` ## Properties -### agentDescription - -• `Optional` **agentDescription**: `string` +### agentDescription? -#### Defined in +> `optional` **agentDescription?**: `string` -[src/genai/subagent.ts:24](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L24) +Defined in: [src/genai/subagent.ts:24](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L24) -___ +*** -### agentId +### agentId? -• `Optional` **agentId**: `string` +> `optional` **agentId?**: `string` -#### Defined in +Defined in: [src/genai/subagent.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L23) -[src/genai/subagent.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L23) +*** -___ +### agentVersion? -### agentVersion +> `optional` **agentVersion?**: `string` -• `Optional` **agentVersion**: `string` +Defined in: [src/genai/subagent.ts:25](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L25) -#### Defined in +*** -[src/genai/subagent.ts:25](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L25) +### model? -___ +> `optional` **model?**: `string` -### model +Defined in: [src/genai/subagent.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L21) -• `Optional` **model**: `string` - -#### Defined in - -[src/genai/subagent.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L21) - -___ +*** ### name -• **name**: `string` +> **name**: `string` -#### Defined in +Defined in: [src/genai/subagent.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L20) -[src/genai/subagent.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L20) +*** -___ +### startTime? -### startTime +> `optional` **startTime?**: `TimeInput` -• `Optional` **startTime**: `TimeInput` +Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) #### Inherited from -SpanInitBase.startTime - -#### Defined in - -[src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) - -___ +`SpanInitBase.startTime` -### systemInstructions +*** -• `Optional` **systemInstructions**: `string`[] +### systemInstructions? -#### Defined in +> `optional` **systemInstructions?**: `string`[] -[src/genai/subagent.ts:22](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L22) \ No newline at end of file +Defined in: [src/genai/subagent.ts:22](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L22) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/tool.mdx b/weave/reference/typescript-sdk/interfaces/tool.mdx new file mode 100644 index 0000000000..acaf8658ea --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/tool.mdx @@ -0,0 +1,169 @@ +--- +title: "Tool" +description: "TypeScript SDK reference" +--- + +Defined in: [src/genai/tool.ts:43](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L43) + +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 twoslash +// @noErrors +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(); +} +``` + +## Extends + +- `SpanBase` + +## Properties + +### args + +> `readonly` **args**: `string` + +Defined in: [src/genai/tool.ts:52](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L52) + +*** + +### name + +> `readonly` **name**: `string` + +Defined in: [src/genai/tool.ts:51](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L51) + +*** + +### result? + +> `optional` **result?**: `string` + +Defined in: [src/genai/tool.ts:47](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L47) + +Tool output as a string. Recorded on `gen_ai.tool.call.result` at `end()`. + +*** + +### toolCallId + +> `readonly` **toolCallId**: `string` + +Defined in: [src/genai/tool.ts:53](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L53) + +## Methods + +### ~~addEvent()~~ + + + **Deprecated.** Record this data via [setAttributes](#setattributes) instead. +OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This +method still works and existing span-event data stays valid. +See https://opentelemetry.io/blog/2026/deprecating-span-events/ + + +> **addEvent**(`name`, `attributes?`, `startTime?`): `this` + +Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) + +Add a named event to the span. Useful for marking non-span moments such as +context compaction, tool-loop detection, or guardrail trips. Warns and +no-ops after `end()`. Mirrors OTel `Span.addEvent`. + +#### Parameters + +##### name + +`string` + +##### attributes? + +`Attributes` + +##### startTime? + +`TimeInput` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.addEvent('context_compacted', {removedMessages: 12}); +``` + +#### Inherited from + +`SpanBase.addEvent` + +*** + +### end() + +> **end**(`opts?`): `void` + +Defined in: [src/genai/tool.ts:87](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L87) + +Flush `result` to the span and close it. Idempotent. Pass `error` to mark +the span as failed; pass `endTime` to backdate the close. + +#### Parameters + +##### opts? + +`SpanEndOptions` + +#### Returns + +`void` + +*** + +### setAttributes() + +> **setAttributes**(`attributes`): `this` + +Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) + +Set multiple attributes on the span at once. Warns and no-ops after +`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's +`set_attributes`). + +#### Parameters + +##### attributes + +`Attributes` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); +``` + +#### Inherited from + +`SpanBase.setAttributes` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/toolinit.mdx b/weave/reference/typescript-sdk/interfaces/toolinit.mdx index fa20989d46..1d2e39a09c 100644 --- a/weave/reference/typescript-sdk/interfaces/toolinit.mdx +++ b/weave/reference/typescript-sdk/interfaces/toolinit.mdx @@ -3,61 +3,44 @@ title: "ToolInit" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/genai/tool.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L17) -- `SpanInitBase` - - ↳ `ToolInit` - -## Table of contents +## Extends -### Properties - -- [args](./toolinit#args) -- [name](./toolinit#name) -- [startTime](./toolinit#starttime) -- [toolCallId](./toolinit#toolcallid) +- `SpanInitBase` ## Properties -### args +### args? -• `Optional` **args**: `string` +> `optional` **args?**: `string` -#### Defined in +Defined in: [src/genai/tool.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L19) -[src/genai/tool.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L19) - -___ +*** ### name -• **name**: `string` +> **name**: `string` -#### Defined in +Defined in: [src/genai/tool.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L18) -[src/genai/tool.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L18) +*** -___ +### startTime? -### startTime +> `optional` **startTime?**: `TimeInput` -• `Optional` **startTime**: `TimeInput` +Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) #### Inherited from -SpanInitBase.startTime - -#### Defined in - -[src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) - -___ +`SpanInitBase.startTime` -### toolCallId +*** -• `Optional` **toolCallId**: `string` +### toolCallId? -#### Defined in +> `optional` **toolCallId?**: `string` -[src/genai/tool.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L20) \ No newline at end of file +Defined in: [src/genai/tool.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L20) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/turn.mdx b/weave/reference/typescript-sdk/interfaces/turn.mdx new file mode 100644 index 0000000000..214cc9c9a7 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/turn.mdx @@ -0,0 +1,277 @@ +--- +title: "Turn" +description: "TypeScript SDK reference" +--- + +Defined in: [src/genai/turn.ts:92](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L92) + +## Extends + +- `SpanBase` + +## Accessors + +### agentName + +#### Get Signature + +> **get** **agentName**(): `string` + +Defined in: [src/genai/turn.ts:103](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L103) + +##### Returns + +`string` + +*** + +### model + +#### Get Signature + +> **get** **model**(): `string` + +Defined in: [src/genai/turn.ts:107](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L107) + +##### Returns + +`string` + +## Methods + +### ~~addEvent()~~ + + + **Deprecated.** Record this data via [setAttributes](#setattributes) instead. +OpenTelemetry is phasing out the Span Event API (`Span.addEvent`). This +method still works and existing span-event data stays valid. +See https://opentelemetry.io/blog/2026/deprecating-span-events/ + + +> **addEvent**(`name`, `attributes?`, `startTime?`): `this` + +Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) + +Add a named event to the span. Useful for marking non-span moments such as +context compaction, tool-loop detection, or guardrail trips. Warns and +no-ops after `end()`. Mirrors OTel `Span.addEvent`. + +#### Parameters + +##### name + +`string` + +##### attributes? + +`Attributes` + +##### startTime? + +`TimeInput` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.addEvent('context_compacted', {removedMessages: 12}); +``` + +#### Inherited from + +`SpanBase.addEvent` + +*** + +### end() + +> **end**(`opts?`): `void` + +Defined in: [src/genai/turn.ts:241](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L241) + +Read current field values (to reflect mutations made via `record()` +since `start`) and close the span. Idempotent. Pass `error` to mark +it as failed; pass `endTime` to backdate the close. + +#### Parameters + +##### opts? + +`SpanEndOptions` + +#### Returns + +`void` + +*** + +### record() + +> **record**(`opts`): `this` + +Defined in: [src/genai/turn.ts:201](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L201) + +Bulk-set any subset of the mutable fields. Replaces (does not merge). +Useful for assigning everything at once after a provider call returns. + +#### Parameters + +##### opts + +###### agentDescription? + +`string` + +###### agentId? + +`string` + +###### agentName? + +`string` + +###### agentVersion? + +`string` + +###### messages? + +[`Message`](./message)[] + +###### model? + +`string` + +###### systemInstructions? + +`string`[] + +#### Returns + +`this` + +*** + +### ~~setAttribute()~~ + + + **Deprecated.** Use [setAttributes](#setattributes) instead, which mirrors the Python +SDK's `set_attributes` and OTel's `Span.setAttributes`. Retained as a thin +alias so existing single-attribute callers keep working. Only `Turn` +carries this — the other emitters never shipped a singular form. + + +> **setAttribute**(`key`, `value`): `this` + +Defined in: [src/genai/turn.ts:193](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L193) + +#### Parameters + +##### key + +`string` + +##### value + +`AttributeValue` + +#### Returns + +`this` + +*** + +### setAttributes() + +> **setAttributes**(`attributes`): `this` + +Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) + +Set multiple attributes on the span at once. Warns and no-ops after +`end()`. Mirrors OTel `Span.setAttributes` (and the Python SDK's +`set_attributes`). + +#### Parameters + +##### attributes + +`Attributes` + +#### Returns + +`this` + +#### Example + +```ts twoslash +// @noErrors +span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); +``` + +#### Inherited from + +`SpanBase.setAttributes` + +*** + +### startLLM() + +> **startLLM**(`opts`): [`LLM`](./llm) + +Defined in: [src/genai/turn.ts:161](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L161) + +Start a child LLM span under this Turn. + +#### Parameters + +##### opts + +[`LLMInit`](./llminit) + +#### Returns + +[`LLM`](./llm) + +*** + +### startSubagent() + +> **startSubagent**(`opts`): [`SubAgent`](./subagent) + +Defined in: [src/genai/turn.ts:179](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L179) + +Start a child SubAgent span under this Turn. + +#### Parameters + +##### opts + +[`SubAgentInit`](./subagentinit) + +#### Returns + +[`SubAgent`](./subagent) + +*** + +### startTool() + +> **startTool**(`opts`): [`Tool`](./tool) + +Defined in: [src/genai/turn.ts:170](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L170) + +Start a child Tool span under this Turn. + +#### Parameters + +##### opts + +[`ToolInit`](./toolinit) + +#### Returns + +[`Tool`](./tool) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/turninit.mdx b/weave/reference/typescript-sdk/interfaces/turninit.mdx index b2e1bceab2..f29d28bf38 100644 --- a/weave/reference/typescript-sdk/interfaces/turninit.mdx +++ b/weave/reference/typescript-sdk/interfaces/turninit.mdx @@ -3,105 +3,76 @@ title: "TurnInit" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/genai/turn.ts:31](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L31) -- `SpanInitBase` - - ↳ `TurnInit` - -## Table of contents - -### Properties +## Extends -- [agentDescription](./turninit#agentdescription) -- [agentId](./turninit#agentid) -- [agentName](./turninit#agentname) -- [agentVersion](./turninit#agentversion) -- [model](./turninit#model) -- [startTime](./turninit#starttime) -- [systemInstructions](./turninit#systeminstructions) -- [userMessage](./turninit#usermessage) +- `SpanInitBase` ## Properties -### agentDescription - -• `Optional` **agentDescription**: `string` - -#### Defined in +### agentDescription? -[src/genai/turn.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L37) +> `optional` **agentDescription?**: `string` -___ +Defined in: [src/genai/turn.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L37) -### agentId +*** -• `Optional` **agentId**: `string` +### agentId? -#### Defined in +> `optional` **agentId?**: `string` -[src/genai/turn.ts:35](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L35) +Defined in: [src/genai/turn.ts:35](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L35) -___ +*** -### agentName +### agentName? -• `Optional` **agentName**: `string` +> `optional` **agentName?**: `string` -#### Defined in +Defined in: [src/genai/turn.ts:36](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L36) -[src/genai/turn.ts:36](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L36) +*** -___ +### agentVersion? -### agentVersion +> `optional` **agentVersion?**: `string` -• `Optional` **agentVersion**: `string` +Defined in: [src/genai/turn.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L38) -#### Defined in +*** -[src/genai/turn.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L38) +### model? -___ +> `optional` **model?**: `string` -### model +Defined in: [src/genai/turn.ts:32](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L32) -• `Optional` **model**: `string` +*** -#### Defined in +### startTime? -[src/genai/turn.ts:32](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L32) +> `optional` **startTime?**: `TimeInput` -___ - -### startTime - -• `Optional` **startTime**: `TimeInput` +Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) #### Inherited from -SpanInitBase.startTime - -#### Defined in - -[src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L17) - -___ - -### systemInstructions +`SpanInitBase.startTime` -• `Optional` **systemInstructions**: `string`[] +*** -#### Defined in +### systemInstructions? -[src/genai/turn.ts:33](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L33) +> `optional` **systemInstructions?**: `string`[] -___ +Defined in: [src/genai/turn.ts:33](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L33) -### userMessage +*** -• `Optional` **userMessage**: `string` +### userMessage? -#### Defined in +> `optional` **userMessage?**: `string` -[src/genai/turn.ts:34](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L34) \ No newline at end of file +Defined in: [src/genai/turn.ts:34](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L34) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/usage.mdx b/weave/reference/typescript-sdk/interfaces/usage.mdx index ef3682bbad..d0bdbc756e 100644 --- a/weave/reference/typescript-sdk/interfaces/usage.mdx +++ b/weave/reference/typescript-sdk/interfaces/usage.mdx @@ -3,62 +3,44 @@ title: "Usage" description: "TypeScript SDK reference" --- -## Table of contents - -### Properties - -- [cacheCreationInputTokens](./usage#cachecreationinputtokens) -- [cacheReadInputTokens](./usage#cachereadinputtokens) -- [inputTokens](./usage#inputtokens) -- [outputTokens](./usage#outputtokens) -- [reasoningTokens](./usage#reasoningtokens) +Defined in: [src/genai/types.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L37) ## Properties -### cacheCreationInputTokens - -• `Optional` **cacheCreationInputTokens**: `number` - -#### Defined in - -[src/genai/types.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L41) - -___ - -### cacheReadInputTokens +### cacheCreationInputTokens? -• `Optional` **cacheReadInputTokens**: `number` +> `optional` **cacheCreationInputTokens?**: `number` -#### Defined in +Defined in: [src/genai/types.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L41) -[src/genai/types.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L42) +*** -___ +### cacheReadInputTokens? -### inputTokens +> `optional` **cacheReadInputTokens?**: `number` -• `Optional` **inputTokens**: `number` +Defined in: [src/genai/types.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L42) -#### Defined in +*** -[src/genai/types.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L38) +### inputTokens? -___ +> `optional` **inputTokens?**: `number` -### outputTokens +Defined in: [src/genai/types.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L38) -• `Optional` **outputTokens**: `number` +*** -#### Defined in +### outputTokens? -[src/genai/types.ts:39](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L39) +> `optional` **outputTokens?**: `number` -___ +Defined in: [src/genai/types.ts:39](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L39) -### reasoningTokens +*** -• `Optional` **reasoningTokens**: `number` +### reasoningTokens? -#### Defined in +> `optional` **reasoningTokens?**: `number` -[src/genai/types.ts:40](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L40) \ No newline at end of file +Defined in: [src/genai/types.ts:40](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L40) \ 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 55be1659a7..37aa376d61 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx @@ -3,54 +3,40 @@ title: "WeaveAudio" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/media.ts:47](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L47) -- `WeaveAudioInput` - - ↳ `WeaveAudio` - -## Table of contents +## Extends -### Properties - -- [\_weaveType](./weaveaudio#_weavetype) -- [audioType](./weaveaudio#audiotype) -- [data](./weaveaudio#data) +- `WeaveAudioInput` ## Properties ### \_weaveType -• **\_weaveType**: ``"Audio"`` +> **\_weaveType**: `"Audio"` -#### Defined in +Defined in: [src/media.ts:48](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L48) -[src/media.ts:48](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L48) +*** -___ +### audioType? -### audioType +> `optional` **audioType?**: `"wav"` -• `Optional` **audioType**: ``"wav"`` +Defined in: [src/media.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L44) #### Inherited from -WeaveAudioInput.audioType +`WeaveAudioInput.audioType` -#### Defined in - -[src/media.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L44) - -___ +*** ### data -• **data**: `Buffer`\<`ArrayBufferLike`\> +> **data**: `Buffer` -#### Inherited from +Defined in: [src/media.ts:43](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L43) -WeaveAudioInput.data - -#### Defined in +#### Inherited from -[src/media.ts:43](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L43) \ No newline at end of file +`WeaveAudioInput.data` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/weaveclient.mdx b/weave/reference/typescript-sdk/interfaces/weaveclient.mdx new file mode 100644 index 0000000000..7d6a2a4169 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/weaveclient.mdx @@ -0,0 +1,951 @@ +--- +title: "WeaveClient" +description: "TypeScript SDK reference" +--- + +Defined in: [src/weaveClient.ts:445](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L445) + +## Properties + +### projectId + +> **projectId**: `string` + +Defined in: [src/weaveClient.ts:456](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L456) + +*** + +### settings + +> **settings**: [`Settings`](../type-aliases/settings) + +Defined in: [src/weaveClient.ts:457](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L457) + +*** + +### traceServerApi + +> **traceServerApi**: `Api`\<`any`\> + +Defined in: [src/weaveClient.ts:455](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L455) + +## Methods + +### addScore() + +> **addScore**(`predictCallId`, `scorerCallId`, `runnableRefUri`, `scorerOutput`): `Promise`\<`string`\> + +Defined in: [src/weaveClient.ts:1727](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1727) + +Add a scorer result (e.g., scorer output) to a call. +Used in imperative evaluation to attach scorer results to predict calls. + +#### Parameters + +##### predictCallId + +`string` + +ID of the predict call to attach feedback to + +##### scorerCallId + +`string` + +ID of the scorer call that generated the feedback + +##### runnableRefUri + +`string` + +URI of the scorer (Op or Object ref) + +##### scorerOutput + +`any` + +Output of the scorer + +#### Returns + +`Promise`\<`string`\> + +*** + +### createCall() + +> **createCall**(`internalCall`, `opRef`, `params`, `parameterNames`, `thisArg`, `currentCall`, `parentCall`, `startTime`, `displayName?`, `attributes?`): `Promise`\<`void`\> + +Defined in: [src/weaveClient.ts:1570](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1570) + +#### Parameters + +##### internalCall + +`InternalCall` + +##### opRef + +`any` + +##### params + +`any`[] + +##### parameterNames + +`ParameterNamesOption` + +##### thisArg + +`any` + +##### currentCall + +`CallStackEntry` + +##### parentCall + +`CallStackEntry` \| `undefined` + +##### startTime + +`Date` + +##### displayName? + +`string` + +##### attributes? + +`Record`\<`string`, `any`\> + +#### Returns + +`Promise`\<`void`\> + +*** + +### finishCall() + +> **finishCall**(`call`, `result`, `currentCall`, `parentCall`, `summarize`, `endTime`, `startCallPromise`): `Promise`\<`void`\> + +Defined in: [src/weaveClient.ts:1630](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1630) + +#### Parameters + +##### call + +`InternalCall` + +##### result + +`any` + +##### currentCall + +`CallStackEntry` + +##### parentCall + +`CallStackEntry` \| `undefined` + +##### summarize + +((`result`) => `Record`\<`string`, `any`\>) \| `undefined` + +##### endTime + +`Date` + +##### startCallPromise + +`Promise`\<`void`\> + +#### Returns + +`Promise`\<`void`\> + +*** + +### finishCallWithException() + +> **finishCallWithException**(`call`, `error`, `currentCall`, `parentCall`, `endTime`, `startCallPromise`): `Promise`\<`void`\> + +Defined in: [src/weaveClient.ts:1672](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1672) + +#### Parameters + +##### call + +`InternalCall` + +##### error + +`any` + +##### currentCall + +`CallStackEntry` + +##### parentCall + +`CallStackEntry` \| `undefined` + +##### endTime + +`Date` + +##### startCallPromise + +`Promise`\<`void`\> + +#### Returns + +`Promise`\<`void`\> + +*** + +### get() + +> **get**(`ref`): `Promise`\<`any`\> + +Defined in: [src/weaveClient.ts:1025](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1025) + +#### Parameters + +##### ref + +[`ObjectRef`](../classes/objectref) + +#### Returns + +`Promise`\<`any`\> + +*** + +### getAgentCustomAttributes() + +> **getAgentCustomAttributes**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`GetAgentCustomAttributesResult`\>\> + +Defined in: [src/weaveClient.ts:772](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L772) + +Discover typed custom-attribute keys observed on agent spans in the +project. Each result row is one `(source, key, value_type)` triple plus +a count of how many spans carry it, which is what the spans +query/group/stats APIs use to reference custom attrs. + +Filter the spans considered by passing `query` (a structured span +filter), `startedAfter` / `startedBefore` (ISO-8601), or both. Use +`limit` / `offset` to page through the discovered keys. + +#### Parameters + +##### options + +`GetAgentCustomAttributesOptions` + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<`GetAgentCustomAttributesResult`\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgentCustomAttributes({ + query: { + $expr: { + $eq: [{$getField: 'agent_name'}, {$literal: 'my-agent'}], + }, + }, + startedAfter: '2026-06-15T00:00:00Z', + limit: 200, +}); + +for (const attr of resp.data.attributes ?? []) { + console.log(`${attr.source}.${attr.key} (${attr.value_type}): ${attr.span_count}`); +} +``` + +*** + +### getAgents() + +> **getAgents**(`options?`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentsResult`](../type-aliases/getagentsresult)\>\> + +Defined in: [src/weaveClient.ts:488](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L488) + +List agents with aggregated stats. + +#### Parameters + +##### options? + +[`GetAgentsOptions`](./getagentsoptions) = `{}` + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentsResult`](../type-aliases/getagentsresult)\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgents({limit: 20}); + +for (const agent of resp.data.agents) { + console.log(agent.agent_name, agent.total_input_tokens); +} + +console.log(`total count: ${resp.data.total_count}`) +``` + +*** + +### getAgentSpans() + +> **getAgentSpans**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentSpansResult`](../type-aliases/getagentspansresult)\>\> + +Defined in: [src/weaveClient.ts:566](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L566) + +Query agent spans, optionally filtered by agent name and/or a mongo-style +query expression. + +#### Parameters + +##### options + +[`GetAgentSpansOptions`](./getagentspansoptions) + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentSpansResult`](../type-aliases/getagentspansresult)\>\> + +#### Examples + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgentSpans({agentName: 'my-agent', limit: 20}); + +for (const span of resp.data.spans) { + console.log(span.span_id, span.span_name, span.input_tokens); +} +``` + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); + +const resp = await client.getAgentSpans({ + agentName: 'my-agent', + query: { + $expr: {$gt: [{$getField: 'input_tokens'}, {$literal: 1000}]}, + }, +}); + +for (const span of resp.data.spans) { + console.log(span.span_id, span.span_name, span.input_tokens); +} +``` + +*** + +### getAgentSpanStats() + +> **getAgentSpanStats**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`GetAgentSpanStatsResult`\>\> + +Defined in: [src/weaveClient.ts:621](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L621) + +Agregations over agent spans in the project, returned as rows + column +metadata suitable for time-series / bucketed visualizations. + +`start` (required) and `end` define the time window. Each entry in +`metrics` declares a field to extract and how to aggregate it (`sum`, +`avg`, `count`, percentiles, etc.). Pass `granularity` (seconds) to +bucket rows by time, or `groupBy` to break results out per agent / +provider / model / etc. `query` filters the underlying spans before +aggregation. + +#### Parameters + +##### options + +`GetAgentSpanStatsOptions` + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<`GetAgentSpanStatsResult`\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgentSpanStats({ + start: '2026-06-10T00:00:00Z', + end: '2026-06-23T00:00:00Z', + granularity: 86400, // one row per day + metrics: [ + { + alias: 'total_input_tokens', + value_type: 'number', + aggregations: ['sum'], + value: {source: 'field', key: 'input_tokens'}, + }, + ], + groupBy: [{key: 'agent_name'}], +}); + +for (const row of resp.data.rows ?? []) { + console.log(row.started_at_bucket, row.agent_name, row.total_input_tokens); +} +``` + +*** + +### getAgentTurn() + +> **getAgentTurn**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`AgentTraceChatRes`\>\> + +Defined in: [src/weaveClient.ts:655](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L655) + +Get data (including messages) for a single turn (by traceId). + +#### Parameters + +##### options + +[`GetAgentTurnOptions`](./getagentturnoptions) + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<`AgentTraceChatRes`\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgentTurn({ + traceId: '01997b8a-2c89-7c4d-9d0e-2f7e5b9a1b2c', + includeFeedback: true, +}); + +console.log(resp.data.root_span_name, resp.data.total_duration_ms); + +for (const message of resp.data.messages ?? []) { + if (message.user_message) console.log('user:', message.user_message); + if (message.assistant_message) console.log('assistant:', message.assistant_message); +} +``` + +*** + +### getAgentTurns() + +> **getAgentTurns**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentTurnsResult`](../type-aliases/getagentturnsresult)\>\> + +Defined in: [src/weaveClient.ts:688](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L688) + +Get data (including messages) for many turns (by conversationId). + +#### Parameters + +##### options + +[`GetAgentTurnsOptions`](./getagentturnsoptions) + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentTurnsResult`](../type-aliases/getagentturnsresult)\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgentTurns({ + conversationId: 'trace_c50312356de3487fa90e381c9399b5b4', + limit: 20, + includeFeedback: true, +}); + +for (const turn of resp.data.turns ?? []) { + console.log(turn.trace_id, turn.root_span_name); + for (const message of turn.messages ?? []) { + if (message.user_message) console.log('user:', message.user_message); + if (message.assistant_message) console.log('assistant:', message.assistant_message); + } +} + +console.log(`total turns: ${resp.data.total_turns}, has more: ${resp.data.has_more}`); +``` + +*** + +### getAgentVersions() + +> **getAgentVersions**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentVersionsResult`](../type-aliases/getagentversionsresult)\>\> + +Defined in: [src/weaveClient.ts:522](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L522) + +List versions for a given agent. + +#### Parameters + +##### options + +[`GetAgentVersionsOptions`](./getagentversionsoptions) + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentVersionsResult`](../type-aliases/getagentversionsresult)\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.getAgentVersions({agentName: 'my-agent', limit: 20}); + +for (const version of resp.data.versions) { + console.log(version.agent_version, version.total_input_tokens); +} + +console.log(`total count: ${resp.data.total_count}`) +``` + +*** + +### getCall() + +> **getCall**(`callId`, `includeCosts?`): `Promise`\<`Call`\> + +Defined in: [src/weaveClient.ts:902](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L902) + +#### Parameters + +##### callId + +`string` + +##### includeCosts? + +`boolean` = `false` + +#### Returns + +`Promise`\<`Call`\> + +*** + +### getCalls() + +#### Call Signature + +> **getCalls**(`options?`): `Promise`\<`Call`[]\> + +Defined in: [src/weaveClient.ts:935](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L935) + +##### Parameters + +###### options? + +[`GetCallsOptions`](./getcallsoptions) + +##### Returns + +`Promise`\<`Call`[]\> + +#### Call Signature + +> **getCalls**(`options?`, `includeCosts?`, `limit?`): `Promise`\<`Call`[]\> + +Defined in: [src/weaveClient.ts:936](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L936) + +##### Parameters + +###### options? + +[`CallsFilter`](./callsfilter) + +###### includeCosts? + +`boolean` + +###### limit? + +`number` + +##### Returns + +`Promise`\<`Call`[]\> + +*** + +### getCallsIterator() + +#### Call Signature + +> **getCallsIterator**(`options?`, `includeCosts?`, `limit?`): `AsyncIterableIterator`\<[`CallSchema`](./callschema)\> + +Defined in: [src/weaveClient.ts:957](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L957) + +##### Parameters + +###### options? + +[`CallsFilter`](./callsfilter) + +###### includeCosts? + +`boolean` + +###### limit? + +`number` + +##### Returns + +`AsyncIterableIterator`\<[`CallSchema`](./callschema)\> + +#### Call Signature + +> **getCallsIterator**(`options?`): `AsyncIterableIterator`\<[`CallSchema`](./callschema)\> + +Defined in: [src/weaveClient.ts:962](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L962) + +##### Parameters + +###### options? + +[`GetCallsOptions`](./getcallsoptions) + +##### Returns + +`AsyncIterableIterator`\<[`CallSchema`](./callschema)\> + +*** + +### getCallStack() + +> **getCallStack**(): `CallStack` + +Defined in: [src/weaveClient.ts:1482](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1482) + +#### Returns + +`CallStack` + +*** + +### getCurrentAttributes() + +> **getCurrentAttributes**(): `Record`\<`string`, `any`\> + +Defined in: [src/weaveClient.ts:1486](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1486) + +#### Returns + +`Record`\<`string`, `any`\> + +*** + +### linkPromptToRegistry() + +> **linkPromptToRegistry**(`prompt`, `options`): `Promise`\<`LinkAssetToRegistryRes`\> + +Defined in: [src/weaveClient.ts:1181](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1181) + +Link a published prompt version into a registry portfolio. + +#### Parameters + +##### prompt + +`RegistryLinkable` + +##### options + +`LinkPromptToRegistryOptions` + +#### Returns + +`Promise`\<`LinkAssetToRegistryRes`\> + +*** + +### publish() + +> **publish**(`obj`, `objId?`): `Promise`\<[`ObjectRef`](../classes/objectref)\> + +Defined in: [src/weaveClient.ts:890](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L890) + +#### Parameters + +##### obj + +`any` + +##### objId? + +`string` + +#### Returns + +`Promise`\<[`ObjectRef`](../classes/objectref)\> + +*** + +### pushNewCall() + +> **pushNewCall**(): `object` + +Defined in: [src/weaveClient.ts:1490](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1490) + +#### Returns + +`object` + +##### currentCall + +> **currentCall**: `CallStackEntry` + +##### newStack + +> **newStack**: `CallStack` + +##### parentCall? + +> `optional` **parentCall?**: `CallStackEntry` + +*** + +### runWithAttributes() + +> **runWithAttributes**\<`T`\>(`attributes`, `fn`): `T` + +Defined in: [src/weaveClient.ts:1498](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1498) + +#### Type Parameters + +##### T + +`T` + +#### Parameters + +##### attributes + +`Record`\<`string`, `any`\> + +##### fn + +() => `T` + +#### Returns + +`T` + +*** + +### runWithCallStack() + +> **runWithCallStack**\<`T`\>(`callStack`, `fn`): `T` + +Defined in: [src/weaveClient.ts:1494](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1494) + +#### Type Parameters + +##### T + +`T` + +#### Parameters + +##### callStack + +`CallStack` + +##### fn + +() => `T` + +#### Returns + +`T` + +*** + +### saveCallEnd() + +> **saveCallEnd**(`callEnd`): `void` + +Defined in: [src/weaveClient.ts:1477](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1477) + +#### Parameters + +##### callEnd + +`EndedCallSchemaForInsert` + +#### Returns + +`void` + +*** + +### saveCallStart() + +> **saveCallStart**(`callStart`): `void` + +Defined in: [src/weaveClient.ts:1472](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1472) + +#### Parameters + +##### callStart + +`StartedCallSchemaForInsert` + +#### Returns + +`void` + +*** + +### saveOp() + +> **saveOp**(`op`, `objId?`): `Promise`\<`OpRef`\> + +Defined in: [src/weaveClient.ts:1537](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1537) + +#### Parameters + +##### op + +[`Op`](../type-aliases/op)\<(...`args`) => `any`\> + +##### objId? + +`string` + +#### Returns + +`Promise`\<`OpRef`\> + +*** + +### searchAgents() + +> **searchAgents**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`SearchAgentsResult`\>\> + +Defined in: [src/weaveClient.ts:730](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L730) + +Full-text search across agent messages in the project. Returns hits +grouped by conversation, with a preview of each matched message. + +`query` is the full-text search term. Pass an empty string to retrieve +all messages matching the structured filters (`agentName`, +`conversationId`, `traceId`) without text matching. Use `limit` / +`offset` to page through results. + +#### Parameters + +##### options + +`SearchAgentsOptions` + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<`SearchAgentsResult`\>\> + +#### Example + +```ts twoslash +// @noErrors +const client = await weave.init('entity/project'); +const resp = await client.searchAgents({ + query: 'Liverpool', + agentName: 'Assistant', + limit: 20, +}); + +for (const conversation of resp.data.results ?? []) { + console.log(`${conversation.conversation_id} (${conversation.agent_name})`); + for (const match of conversation.matched_messages) { + console.log(` [${match.role}] ${match.content_preview}`); + } +} + +console.log(`total conversations: ${resp.data.total_conversations}`); +``` + +*** + +### serializeAudio() + +> **serializeAudio**(`data`, `audioType?`): `Promise`\<`SerializedFileBlob`\> + +Defined in: [src/weaveClient.ts:1424](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1424) + +Upload raw audio bytes to the Weave content store and return the +`CustomWeaveType` placeholder that can be embedded in a call output. + +Use this when building call outputs manually (e.g. via `saveCallEnd`) +where the automatic serialization pipeline from `finishCall` is not used. + +#### Parameters + +##### data + +`Buffer` + +Raw audio bytes (WAV for best browser compatibility) + +##### audioType? + +`"wav"` = `DEFAULT_AUDIO_TYPE` + +File format — currently only 'wav' is supported + +#### Returns + +`Promise`\<`SerializedFileBlob`\> + +*** + +### updateCall() + +> **updateCall**(`callId`, `displayName`): `Promise`\<`void`\> + +Defined in: [src/weaveClient.ts:1710](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1710) + +#### Parameters + +##### callId + +`string` + +##### displayName + +`string` + +#### Returns + +`Promise`\<`void`\> + +*** + +### waitForBatchProcessing() + +> **waitForBatchProcessing**(): `Promise`\<`void`\> + +Defined in: [src/weaveClient.ts:801](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L801) + +#### Returns + +`Promise`\<`void`\> \ 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 5f5c318e3c..c237d47ecf 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx @@ -3,54 +3,40 @@ title: "WeaveImage" description: "TypeScript SDK reference" --- -## Hierarchy +Defined in: [src/media.ts:13](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L13) -- `WeaveImageInput` - - ↳ `WeaveImage` - -## Table of contents +## Extends -### Properties - -- [\_weaveType](./weaveimage#_weavetype) -- [data](./weaveimage#data) -- [imageType](./weaveimage#imagetype) +- `WeaveImageInput` ## Properties ### \_weaveType -• **\_weaveType**: ``"Image"`` +> **\_weaveType**: `"Image"` -#### Defined in +Defined in: [src/media.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L14) -[src/media.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L14) - -___ +*** ### data -• **data**: `Buffer`\<`ArrayBufferLike`\> +> **data**: `Buffer` -#### Inherited from +Defined in: [src/media.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L9) -WeaveImageInput.data +#### Inherited from -#### Defined in +`WeaveImageInput.data` -[src/media.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L9) +*** -___ +### imageType? -### imageType +> `optional` **imageType?**: `"png"` -• `Optional` **imageType**: ``"png"`` +Defined in: [src/media.ts:10](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L10) #### Inherited from -WeaveImageInput.imageType - -#### Defined in - -[src/media.ts:10](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L10) \ No newline at end of file +`WeaveImageInput.imageType` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/agent.mdx b/weave/reference/typescript-sdk/type-aliases/agent.mdx index 2bd51309fe..0075d64f52 100644 --- a/weave/reference/typescript-sdk/type-aliases/agent.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agent.mdx @@ -3,12 +3,6 @@ title: "Agent" description: "TypeScript SDK reference" --- -# Agent +> **Agent** = `AgentSchema` -Ƭ **Agent**: `AgentSchema` - -#### Defined in - -[src/weaveClient.ts:105](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L105) - -___ +Defined in: [src/weaveClient.ts:105](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L105) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/agentmessage.mdx b/weave/reference/typescript-sdk/type-aliases/agentmessage.mdx index fbeb2a8cb7..fdc0a7a28d 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentmessage.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentmessage.mdx @@ -3,12 +3,6 @@ title: "AgentMessage" description: "TypeScript SDK reference" --- -# AgentMessage +> **AgentMessage** = `AgentChatMessageSchema` -Ƭ **AgentMessage**: `AgentChatMessageSchema` - -#### Defined in - -[src/weaveClient.ts:107](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L107) - -___ +Defined in: [src/weaveClient.ts:107](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L107) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/agentspan.mdx b/weave/reference/typescript-sdk/type-aliases/agentspan.mdx index 9171736998..5fc11bc1e2 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentspan.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentspan.mdx @@ -3,12 +3,6 @@ title: "AgentSpan" description: "TypeScript SDK reference" --- -# AgentSpan +> **AgentSpan** = `AgentSpanSchema` -Ƭ **AgentSpan**: `AgentSpanSchema` - -#### Defined in - -[src/weaveClient.ts:108](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L108) - -___ +Defined in: [src/weaveClient.ts:108](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L108) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/agentturn.mdx b/weave/reference/typescript-sdk/type-aliases/agentturn.mdx index 0764332882..002b7765bf 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentturn.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentturn.mdx @@ -3,12 +3,6 @@ title: "AgentTurn" description: "TypeScript SDK reference" --- -# AgentTurn +> **AgentTurn** = `AgentTraceChatRes` -Ƭ **AgentTurn**: `AgentTraceChatRes` - -#### Defined in - -[src/weaveClient.ts:109](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L109) - -___ +Defined in: [src/weaveClient.ts:109](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L109) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/agentversion.mdx b/weave/reference/typescript-sdk/type-aliases/agentversion.mdx index 71740a0b85..7a1075342e 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentversion.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentversion.mdx @@ -3,12 +3,6 @@ title: "AgentVersion" description: "TypeScript SDK reference" --- -# AgentVersion +> **AgentVersion** = `AgentVersionSchema` -Ƭ **AgentVersion**: `AgentVersionSchema` - -#### Defined in - -[src/weaveClient.ts:110](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L110) - -___ +Defined in: [src/weaveClient.ts:110](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L110) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/getagentspansresult.mdx b/weave/reference/typescript-sdk/type-aliases/getagentspansresult.mdx index 65841cffce..fc559e63d5 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentspansresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentspansresult.mdx @@ -3,21 +3,24 @@ title: "GetAgentSpansResult" description: "TypeScript SDK reference" --- -# GetAgentSpansResult +> **GetAgentSpansResult** = `object` -Ƭ **GetAgentSpansResult**: `Object` +Defined in: [src/weaveClient.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L183) -Result shape returned by [WeaveClient.getAgentSpans](../classes/weaveclient#getagentspans). +Result shape returned by [WeaveClient.getAgentSpans](../interfaces/weaveclient#getagentspans). -#### Type declaration +## Properties -| Name | Type | -| :------ | :------ | -| `spans` | [`AgentSpan`](./agentspan)[] | -| `total_count?` | `number` | +### spans -#### Defined in +> **spans**: [`AgentSpan`](./agentspan)[] -[src/weaveClient.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L183) +Defined in: [src/weaveClient.ts:184](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L184) -___ +*** + +### total\_count? + +> `optional` **total\_count?**: `number` + +Defined in: [src/weaveClient.ts:185](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L185) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/getagentsresult.mdx b/weave/reference/typescript-sdk/type-aliases/getagentsresult.mdx index 3b6141113f..e241fb4ee2 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentsresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentsresult.mdx @@ -3,21 +3,24 @@ title: "GetAgentsResult" description: "TypeScript SDK reference" --- -# GetAgentsResult +> **GetAgentsResult** = `object` -Ƭ **GetAgentsResult**: `Object` +Defined in: [src/weaveClient.ts:125](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L125) -Result shape returned by [WeaveClient.getAgents](../classes/weaveclient#getagents). +Result shape returned by [WeaveClient.getAgents](../interfaces/weaveclient#getagents). -#### Type declaration +## Properties -| Name | Type | -| :------ | :------ | -| `agents` | [`Agent`](./agent)[] | -| `total_count?` | `number` | +### agents -#### Defined in +> **agents**: [`Agent`](./agent)[] -[src/weaveClient.ts:125](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L125) +Defined in: [src/weaveClient.ts:126](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L126) -___ +*** + +### total\_count? + +> `optional` **total\_count?**: `number` + +Defined in: [src/weaveClient.ts:127](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L127) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/getagentturnresult.mdx b/weave/reference/typescript-sdk/type-aliases/getagentturnresult.mdx index 27e17c8df4..4e782ff90c 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentturnresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentturnresult.mdx @@ -3,14 +3,8 @@ title: "GetAgentTurnResult" description: "TypeScript SDK reference" --- -# GetAgentTurnResult +> **GetAgentTurnResult** = [`AgentTurn`](./agentturn) -Ƭ **GetAgentTurnResult**: [`AgentTurn`](./agentturn) +Defined in: [src/weaveClient.ts:228](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L228) -Result shape returned by [WeaveClient.getAgentTurn](../classes/weaveclient#getagentturn). - -#### Defined in - -[src/weaveClient.ts:228](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L228) - -___ +Result shape returned by [WeaveClient.getAgentTurn](../interfaces/weaveclient#getagentturn). \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/getagentturnsresult.mdx b/weave/reference/typescript-sdk/type-aliases/getagentturnsresult.mdx index 902a25ad06..2bbd8c76fb 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentturnsresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentturnsresult.mdx @@ -3,26 +3,64 @@ title: "GetAgentTurnsResult" description: "TypeScript SDK reference" --- -# GetAgentTurnsResult +> **GetAgentTurnsResult** = `object` -Ƭ **GetAgentTurnsResult**: `Object` +Defined in: [src/weaveClient.ts:252](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L252) -Result shape returned by [WeaveClient.getAgentTurns](../classes/weaveclient#getagentturns). +Result shape returned by [WeaveClient.getAgentTurns](../interfaces/weaveclient#getagentturns). -#### Type declaration +## Properties -| Name | Type | -| :------ | :------ | -| `conversation_id` | `string` | -| `feedback?` | `Record`\<`string`, `any`\>[] \| ``null`` | -| `has_more?` | `boolean` | -| `limit?` | `number` | -| `offset?` | `number` | -| `total_turns?` | `number` | -| `turns?` | [`AgentTurn`](./agentturn)[] | +### conversation\_id -#### Defined in +> **conversation\_id**: `string` -[src/weaveClient.ts:252](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L252) +Defined in: [src/weaveClient.ts:253](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L253) -___ +*** + +### feedback? + +> `optional` **feedback?**: `Record`\<`string`, `any`\>[] \| `null` + +Defined in: [src/weaveClient.ts:259](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L259) + +*** + +### has\_more? + +> `optional` **has\_more?**: `boolean` + +Defined in: [src/weaveClient.ts:256](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L256) + +*** + +### limit? + +> `optional` **limit?**: `number` + +Defined in: [src/weaveClient.ts:257](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L257) + +*** + +### offset? + +> `optional` **offset?**: `number` + +Defined in: [src/weaveClient.ts:258](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L258) + +*** + +### total\_turns? + +> `optional` **total\_turns?**: `number` + +Defined in: [src/weaveClient.ts:255](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L255) + +*** + +### turns? + +> `optional` **turns?**: [`AgentTurn`](./agentturn)[] + +Defined in: [src/weaveClient.ts:254](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L254) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/getagentversionsresult.mdx b/weave/reference/typescript-sdk/type-aliases/getagentversionsresult.mdx index 7398af01f4..198daacf36 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentversionsresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentversionsresult.mdx @@ -3,21 +3,24 @@ title: "GetAgentVersionsResult" description: "TypeScript SDK reference" --- -# GetAgentVersionsResult +> **GetAgentVersionsResult** = `object` -Ƭ **GetAgentVersionsResult**: `Object` +Defined in: [src/weaveClient.ts:152](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L152) -Result shape returned by [WeaveClient.getAgentVersions](../classes/weaveclient#getagentversions). +Result shape returned by [WeaveClient.getAgentVersions](../interfaces/weaveclient#getagentversions). -#### Type declaration +## Properties -| Name | Type | -| :------ | :------ | -| `total_count?` | `number` | -| `versions` | [`AgentVersion`](./agentversion)[] | +### total\_count? -#### Defined in +> `optional` **total\_count?**: `number` -[src/weaveClient.ts:152](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L152) +Defined in: [src/weaveClient.ts:154](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L154) -___ +*** + +### versions + +> **versions**: [`AgentVersion`](./agentversion)[] + +Defined in: [src/weaveClient.ts:153](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L153) \ 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 index 222ef9efeb..360e8d3db9 100644 --- a/weave/reference/typescript-sdk/type-aliases/messagepart.mdx +++ b/weave/reference/typescript-sdk/type-aliases/messagepart.mdx @@ -3,12 +3,6 @@ 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`; \} -Ƭ **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 - -[src/genai/types.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L23) - -___ +Defined in: [src/genai/types.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L23) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/modality.mdx b/weave/reference/typescript-sdk/type-aliases/modality.mdx index 7aadb0f160..f06170e61b 100644 --- a/weave/reference/typescript-sdk/type-aliases/modality.mdx +++ b/weave/reference/typescript-sdk/type-aliases/modality.mdx @@ -3,12 +3,6 @@ title: "Modality" description: "TypeScript SDK reference" --- -# Modality +> **Modality** = `"image"` \| `"audio"` \| `"video"` \| `"document"` -Ƭ **Modality**: ``"image"`` \| ``"audio"`` \| ``"video"`` \| ``"document"`` - -#### Defined in - -[src/genai/types.ts:13](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L13) - -___ +Defined in: [src/genai/types.ts:13](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L13) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/op.mdx b/weave/reference/typescript-sdk/type-aliases/op.mdx index c15fab4a15..9272d84936 100644 --- a/weave/reference/typescript-sdk/type-aliases/op.mdx +++ b/weave/reference/typescript-sdk/type-aliases/op.mdx @@ -1,20 +1,44 @@ --- -title: "Op" +title: "Op" description: "TypeScript SDK reference" --- -# Op +> **Op**\<`T`\> = `object` & `T` & (...`args`) => `ReturnType`\<`T`\> *extends* `AsyncIterable`\ ? `AsyncIterable`\<`Awaited`\<`U`\>\> : `Promise`\<`Awaited`\<`ReturnType`\<`T`\>\>\> -Ƭ **Op**\<`T`\>: \{ `__boundThis?`: [`WeaveObject`](../classes/weaveobject) ; `__isOp`: ``true`` ; `__name`: `string` ; `__parameterNames?`: `ParameterNamesOption` ; `__savedRef?`: `OpRef` \| `Promise`\<`OpRef`\> ; `__wrappedFunction`: `T` ; `invoke`: `CallMethod`\<`T`\> } & `T` & (...`args`: `Parameters`\<`T`\>) => `ReturnType`\<`T`\> extends `AsyncIterable`\ ? `AsyncIterable`\<`Awaited`\<`U`\>\> : `Promise`\<`Awaited`\<`ReturnType`\<`T`\>\>\> +Defined in: [src/opType.ts:7](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/opType.ts#L7) -#### Type parameters +## Type Declaration -| Name | Type | -| :------ | :------ | -| `T` | extends (...`args`: `any`[]) => `any` | +### \_\_boundThis? -#### Defined in +> `optional` **\_\_boundThis?**: [`WeaveObject`](../classes/weaveobject) -[src/opType.ts:7](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/opType.ts#L7) +### \_\_isOp -___ +> **\_\_isOp**: `true` + +### \_\_name + +> **\_\_name**: `string` + +### \_\_parameterNames? + +> `optional` **\_\_parameterNames?**: `ParameterNamesOption` + +### \_\_savedRef? + +> `optional` **\_\_savedRef?**: `OpRef` \| `Promise`\<`OpRef`\> + +### \_\_wrappedFunction + +> **\_\_wrappedFunction**: `T` + +### invoke + +> **invoke**: `CallMethod`\<`T`\> + +## Type Parameters + +### T + +`T` *extends* (...`args`) => `any` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx index 50f13b604d..3495630a67 100644 --- a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx +++ b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx @@ -1,11 +1,11 @@ --- -title: "OpDecorator" +title: "OpDecorator" description: "TypeScript SDK reference" --- -# OpDecorator +> **OpDecorator**\<`T`\> = (`value`, `context`) => `T` \| `void` & (`target`, `propertyKey`, `descriptor`) => `TypedPropertyDescriptor`\<`T`\> \| `void` -Ƭ **OpDecorator**\<`T`\>: (`value`: `T`, `context`: `ClassMethodDecoratorContext`) => `T` \| `void` & (`target`: `object`, `propertyKey`: `string` \| `symbol`, `descriptor`: `TypedPropertyDescriptor`\<`T`\>) => `TypedPropertyDescriptor`\<`T`\> \| `void` +Defined in: [src/opType.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/opType.ts#L41) Helper type for decorators This represents a decorator function that can be used with both legacy and Stage 3 decorators. @@ -19,14 +19,8 @@ For legacy decorators: propertyKey: The method name descriptor: The property descriptor containing the method -#### Type parameters +## Type Parameters -| Name | Type | -| :------ | :------ | -| `T` | extends (...`args`: `any`[]) => `any` | +### T -#### Defined in - -[src/opType.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/opType.ts#L41) - -___ +`T` *extends* (...`args`) => `any` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/response.mdx b/weave/reference/typescript-sdk/type-aliases/response.mdx index 4b724dcd90..15153089bb 100644 --- a/weave/reference/typescript-sdk/type-aliases/response.mdx +++ b/weave/reference/typescript-sdk/type-aliases/response.mdx @@ -1,20 +1,14 @@ --- -title: "Response" +title: "Response" description: "TypeScript SDK reference" --- -# Response +> **Response**\<`T`\> = [`HttpResponse`](../interfaces/httpresponse)\<`T`, [`HTTPValidationError`](../interfaces/httpvalidationerror)\> -Ƭ **Response**\<`T`\>: [`HttpResponse`](../interfaces/httpresponse)\<`T`, [`HTTPValidationError`](../interfaces/httpvalidationerror)\> +Defined in: [src/weaveClient.ts:65](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L65) -#### Type parameters +## Type Parameters -| Name | -| :------ | -| `T` | +### T -#### Defined in - -[src/weaveClient.ts:65](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L65) - -___ +`T` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/role.mdx b/weave/reference/typescript-sdk/type-aliases/role.mdx index 22e4638bb0..1fcfddba2e 100644 --- a/weave/reference/typescript-sdk/type-aliases/role.mdx +++ b/weave/reference/typescript-sdk/type-aliases/role.mdx @@ -3,14 +3,8 @@ title: "Role" description: "TypeScript SDK reference" --- -# Role +> **Role** = `"user"` \| `"assistant"` \| `"system"` \| `"tool"` \| `"developer"` \| `"function"` -Ƭ **Role**: ``"user"`` \| ``"assistant"`` \| ``"system"`` \| ``"tool"`` \| ``"developer"`` \| ``"function"`` +Defined in: [src/genai/types.ts:5](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L5) -Public data types for the Weave GenAI conversation SDK. - -#### Defined in - -[src/genai/types.ts:5](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L5) - -___ +Public data types for the Weave GenAI conversation SDK. \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/session-1.mdx b/weave/reference/typescript-sdk/type-aliases/session-1.mdx new file mode 100644 index 0000000000..57373596ee --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/session-1.mdx @@ -0,0 +1,13 @@ +--- +title: "Session" +description: "TypeScript SDK reference" +--- + + + + **Deprecated.** Use [Conversation](../interfaces/conversation) instead. + + +> **Session** = [`Conversation`](../interfaces/conversation) + +Defined in: [src/genai/conversation.ts:191](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L191) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/session.mdx b/weave/reference/typescript-sdk/type-aliases/session.mdx index 431ddd646f..6f9a1fb9a0 100644 --- a/weave/reference/typescript-sdk/type-aliases/session.mdx +++ b/weave/reference/typescript-sdk/type-aliases/session.mdx @@ -3,18 +3,11 @@ title: "Session" description: "TypeScript SDK reference" --- -# Session - **Deprecated.** Use [Conversation](../classes/conversation) instead. + **Deprecated.** Use [Conversation](../interfaces/conversation) instead. -Ƭ **Session**: [`Conversation`](../classes/conversation) +> **Session** = *typeof* [`Conversation`](../interfaces/conversation) -#### Defined in - -[src/genai/conversation.ts:191](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L191) - -[src/genai/conversation.ts:193](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L193) - -___ +Defined in: [src/genai/conversation.ts:191](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L191) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/sessioninit.mdx b/weave/reference/typescript-sdk/type-aliases/sessioninit.mdx index 05654ff3ef..5e10b4aec1 100644 --- a/weave/reference/typescript-sdk/type-aliases/sessioninit.mdx +++ b/weave/reference/typescript-sdk/type-aliases/sessioninit.mdx @@ -3,16 +3,11 @@ title: "SessionInit" description: "TypeScript SDK reference" --- -# SessionInit **Deprecated.** Use [ConversationInit](../interfaces/conversationinit) instead. -Ƭ **SessionInit**: [`ConversationInit`](../interfaces/conversationinit) +> **SessionInit** = [`ConversationInit`](../interfaces/conversationinit) -#### Defined in - -[src/genai/conversation.ts:189](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L189) - -___ +Defined in: [src/genai/conversation.ts:189](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L189) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/settings.mdx b/weave/reference/typescript-sdk/type-aliases/settings.mdx index 6b5aa89261..0c0ad10b64 100644 --- a/weave/reference/typescript-sdk/type-aliases/settings.mdx +++ b/weave/reference/typescript-sdk/type-aliases/settings.mdx @@ -3,23 +3,73 @@ title: "Settings" description: "TypeScript SDK reference" --- -# Settings +> **Settings** = `object` -Ƭ **Settings**: `Object` +Defined in: [src/settings.ts:3](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L3) -#### Type declaration +## Properties -| Name | Type | Description | -| :------ | :------ | :------ | -| `attributes` | `Record`\<`string`, `any`\> | A map of attributes applied to every trace produced by this client. | -| `genai` | \{ `batchOptions?`: `BufferConfig` ; `spanProcessor?`: ``"batch"`` \| ``"simple"`` \| `SpanProcessor` } | - | -| `genai.batchOptions?` | `BufferConfig` | `BatchSpanProcessor` configuration. Ignored unless `spanProcessor === 'batch'`. | -| `genai.spanProcessor?` | ``"batch"`` \| ``"simple"`` \| `SpanProcessor` | How GenAI spans are exported. - `'batch'` (default): `BatchSpanProcessor`, suitable for production agents and long-lived processes. - `'simple'`: `SimpleSpanProcessor`, one HTTP POST per span. Useful for tests and short-lived CLIs where deterministic flush matters more than throughput. - `SpanProcessor` instance: a user-supplied processor. The caller owns its lifecycle; the Weave OTLP exporter targeting `/agents/otel/v1/traces` is not used. | -| `printCallLink` | `boolean` | Prints links in terminal to Weave UI for ops. `Default` `true` | -| `useOTelV2` | `boolean` | Routes OTel-capable integrations through their OTel variant. `Default` `true` | +### attributes -#### Defined in +> `readonly` **attributes**: `Record`\<`string`, `any`\> -[src/settings.ts:3](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L3) +Defined in: [src/settings.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L14) -## Variables +A map of attributes applied to every trace produced by this client. + +*** + +### genai + +> `readonly` **genai**: `object` + +Defined in: [src/settings.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L23) + +#### batchOptions? + +> `optional` **batchOptions?**: `BufferConfig` + +`BatchSpanProcessor` configuration. Ignored unless `spanProcessor === 'batch'`. + +#### spanProcessor? + +> `optional` **spanProcessor?**: `"batch"` \| `"simple"` \| `SpanProcessor` + +How GenAI spans are exported. + +- `'batch'` (default): `BatchSpanProcessor`, suitable for production + agents and long-lived processes. +- `'simple'`: `SimpleSpanProcessor`, one HTTP POST per span. Useful for + tests and short-lived CLIs where deterministic flush matters more than + throughput. +- `SpanProcessor` instance: a user-supplied processor. The caller owns + its lifecycle; the Weave OTLP exporter targeting `/agents/otel/v1/traces` + is not used. + +*** + +### printCallLink + +> `readonly` **printCallLink**: `boolean` + +Defined in: [src/settings.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L9) + +Prints links in terminal to Weave UI for ops. + +#### Default + +`true` + +*** + +### useOTelV2 + +> **useOTelV2**: `boolean` + +Defined in: [src/settings.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L21) + +Routes OTel-capable integrations through their OTel variant. + +#### Default + +`true` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/variables/endsession.mdx b/weave/reference/typescript-sdk/variables/endsession.mdx new file mode 100644 index 0000000000..4e19c5852a --- /dev/null +++ b/weave/reference/typescript-sdk/variables/endsession.mdx @@ -0,0 +1,37 @@ +--- +title: "endSession" +description: "TypeScript SDK reference" +--- + + + + **Deprecated.** Use [endConversation](../functions/endconversation) instead. + + +> `const` **endSession**: (`opts?`) => `void` = `endConversation` + +Defined in: [src/genai/api.ts:169](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L169) + +End the current Conversation. No-op if no Conversation is active. + +## Parameters + +### opts? + +`SpanEndOptions` + +## Returns + +`void` + +## Examples + +```ts twoslash +// @noErrors +weave.endConversation(); +``` + +```ts twoslash +// @noErrors +weave.endConversation({endTime: new Date('2026-05-29T10:00:01.700Z')}); +``` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/variables/getcurrentsession.mdx b/weave/reference/typescript-sdk/variables/getcurrentsession.mdx new file mode 100644 index 0000000000..d97ddcda22 --- /dev/null +++ b/weave/reference/typescript-sdk/variables/getcurrentsession.mdx @@ -0,0 +1,19 @@ +--- +title: "getCurrentSession" +description: "TypeScript SDK reference" +--- + + + + **Deprecated.** Use [getCurrentConversation](../functions/getcurrentconversation) instead. + + +> `const` **getCurrentSession**: () => [`Conversation`](../interfaces/conversation) \| `undefined` = `getCurrentConversation` + +Defined in: [src/genai/context.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L64) + +Returns the current Conversation, or undefined. + +## Returns + +[`Conversation`](../interfaces/conversation) \| `undefined` \ No newline at end of file diff --git a/weave/reference/typescript-sdk/variables/startsession.mdx b/weave/reference/typescript-sdk/variables/startsession.mdx new file mode 100644 index 0000000000..6a1d48a26a --- /dev/null +++ b/weave/reference/typescript-sdk/variables/startsession.mdx @@ -0,0 +1,45 @@ +--- +title: "startSession" +description: "TypeScript SDK reference" +--- + + + + **Deprecated.** Use [startConversation](../functions/startconversation) instead. + + +> `const` **startSession**: (`opts`) => [`Conversation`](../interfaces/conversation) = `startConversation` + +Defined in: [src/genai/api.ts:33](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L33) + +Start a new Conversation and install it as the current conversation. +Subsequent calls to `startTurn` will pick it up automatically. + +Pass `attributes` to stamp custom (non-semconv) attributes on every +span the conversation emits. + +## Parameters + +### opts? + +[`ConversationInit`](../interfaces/conversationinit) = `{}` + +## Returns + +[`Conversation`](../interfaces/conversation) + +## Examples + +```ts twoslash +// @noErrors +weave.startConversation({agentName: 'research-bot'}); +``` + +```ts twoslash +// @noErrors +weave.startConversation({ + agentName: 'research-bot', + conversationId: '019efa53-8a65-711c-b4c1-7c1cb72c0bb7', + attributes: {'myagent.version': '1.23'}, +}); +``` \ No newline at end of file