diff --git a/fr/models/app/features/custom-charts/walkthrough.mdx b/fr/models/app/features/custom-charts/walkthrough.mdx index d4c9d9f180..f0e85e4616 100644 --- a/fr/models/app/features/custom-charts/walkthrough.mdx +++ b/fr/models/app/features/custom-charts/walkthrough.mdx @@ -66,7 +66,7 @@ Une fois la requête en place, vous pouvez associer vos colonnes enregistrées a La visualisation par défaut constitue un bon point de départ, mais vous pouvez modifier la spécification Vega pour changer le type de graphique, ajouter des titres et affiner l’apparence. Pour passer d’un nuage de points à un graphique en courbes, cliquez sur **Edit** afin de modifier la spécification Vega de ce graphique intégré. Suivez l’exemple dans l’[espace de travail de démonstration des graphiques personnalisés](https://app.wandb.ai/demo-team/custom-charts). - Sélection d’un graphique personnalisé + Sélection d’un graphique personnalisé Mettez à jour la spécification Vega pour personnaliser la visualisation : @@ -82,7 +82,7 @@ Mettez à jour la spécification Vega pour personnaliser la visualisation : Enregistrez un préréglage pour réutiliser la même configuration de graphique dans d’autres panneaux du projet. Pour l’enregistrer comme préréglage que vous pourrez réutiliser ailleurs dans ce projet, cliquez sur **Save as** en haut de la page. Voici à quoi ressemble le résultat, avec une courbe ROC. - Graphique de la courbe PR + Graphique de la courbe PR
@@ -107,9 +107,9 @@ Pour créer votre propre version du panneau d’histogramme composite personnali Voici un exemple de résultat issu d’une brève expérience : un entraînement sur seulement 1 000 exemples pendant une époque génère un modèle qui est sûr que la plupart des images ne sont pas des plantes, mais incertain quant à celles qui pourraient être des animaux. - Configuration du graphique + Configuration du graphique - Résultat du graphique + Résultat du graphique \ No newline at end of file diff --git a/fr/models/app/features/panels/parameter-importance.mdx b/fr/models/app/features/panels/parameter-importance.mdx index 999bfde30a..e005c77240 100644 --- a/fr/models/app/features/panels/parameter-importance.mdx +++ b/fr/models/app/features/panels/parameter-importance.mdx @@ -8,7 +8,7 @@ keywords: ["importance des hyperparamètres", "importance des variables", "forê Le panneau d'importance des paramètres vous aide à déterminer lesquels de vos hyperparamètres prédisent le mieux les valeurs souhaitées de vos métriques et y sont le plus fortement corrélés. Utilisez ce panneau pour orienter vos futures recherches d'hyperparamètres vers les paramètres qui comptent le plus pour les performances du modèle. - Panneau d'importance des paramètres + Panneau d'importance des paramètres La **corrélation** est la corrélation linéaire entre l'hyperparamètre et la métrique choisie (dans ce cas, `val_loss`). Une corrélation élevée signifie que lorsque l'hyperparamètre a une valeur plus élevée, la métrique prend également des valeurs plus élevées, et inversement. La corrélation est une métrique utile, mais elle ne permet pas de capturer les interactions du second ordre entre les entrées, et elle peut devenir difficile à interpréter lorsque vous comparez des entrées de plages différentes. @@ -50,7 +50,7 @@ Avec le gestionnaire des paramètres, vous pouvez définir manuellement les para Les sections suivantes décrivent comment lire les valeurs d’importance et de corrélation affichées dans le panneau afin que vous puissiez vous en servir dans votre prochain balayage. - Analyse de l’importance des variables + Analyse de l’importance des variables Ce panneau affiche tous les paramètres transmis à l’objet [wandb.Run.config](/fr/models/track/config/) dans votre script d’entraînement. Il affiche ensuite l’importance des variables et les corrélations entre ces paramètres de configuration et la métrique du modèle que vous sélectionnez (`val_loss` dans ce cas). diff --git a/fr/models/app/features/panels/scatter-plot.mdx b/fr/models/app/features/panels/scatter-plot.mdx index 6a14a61391..5faa98f061 100644 --- a/fr/models/app/features/panels/scatter-plot.mdx +++ b/fr/models/app/features/panels/scatter-plot.mdx @@ -31,7 +31,7 @@ L’exemple suivant montre un nuage de points affichant l’accuracy de validati [Voir un exemple interactif →](https://app.wandb.ai/l2k2/l2k/reports?view=carey%2FScatter%20Plot) - Nuage de points de l’accuracy de validation + Nuage de points de l’accuracy de validation
diff --git a/images/general/custom-charts-1.png b/images/app_ui/custom-charts-1.png similarity index 100% rename from images/general/custom-charts-1.png rename to images/app_ui/custom-charts-1.png diff --git a/images/general/custom-charts-2.png b/images/app_ui/custom-charts-2.png similarity index 100% rename from images/general/custom-charts-2.png rename to images/app_ui/custom-charts-2.png diff --git a/images/general/custom-charts-3.png b/images/app_ui/custom-charts-3.png similarity index 100% rename from images/general/custom-charts-3.png rename to images/app_ui/custom-charts-3.png diff --git a/images/general/custom-charts-4.png b/images/app_ui/custom-charts-4.png similarity index 100% rename from images/general/custom-charts-4.png rename to images/app_ui/custom-charts-4.png diff --git a/images/general/parameter-importance-1.png b/images/app_ui/parameter-importance-1.png similarity index 100% rename from images/general/parameter-importance-1.png rename to images/app_ui/parameter-importance-1.png diff --git a/images/general/parameter-importance-4.png b/images/app_ui/parameter-importance-4.png similarity index 100% rename from images/general/parameter-importance-4.png rename to images/app_ui/parameter-importance-4.png diff --git a/images/general/scatter-plots-1.png b/images/app_ui/scatter-plots-1.png similarity index 100% rename from images/general/scatter-plots-1.png rename to images/app_ui/scatter-plots-1.png diff --git a/ja/models/app/features/custom-charts/walkthrough.mdx b/ja/models/app/features/custom-charts/walkthrough.mdx index e0f5f441b5..724adb9343 100644 --- a/ja/models/app/features/custom-charts/walkthrough.mdx +++ b/ja/models/app/features/custom-charts/walkthrough.mdx @@ -66,7 +66,7 @@ with wandb.init() as run: デフォルトの可視化は出発点として適していますが、Vega spec を編集することで、チャートのタイプを変更したり、タイトルを追加したり、見た目を調整したりできます。散布図から折れ線グラフに切り替えるには、**Edit** をクリックして、この組み込みチャートの Vega spec を変更してください。[ワークスペース](https://app.wandb.ai/demo-team/custom-charts)を見ながら進めます。 - カスタム チャートの選択 + カスタム チャートの選択 Vega spec を更新して可視化をカスタマイズします。 @@ -82,7 +82,7 @@ Vega spec を更新して可視化をカスタマイズします。 プリセットを保存すると、同じチャート設定を project 内の他のパネルでも再利用できます。この project 内の別の場所でも使えるプリセットとして保存するには、ページ上部の **Save as** をクリックしてください。結果は次のようになり、ROC 曲線も表示されます。 - PR 曲線のチャート + PR 曲線のチャート
@@ -107,9 +107,9 @@ Vega spec を更新して可視化をカスタマイズします。 以下は、短時間の実験で得られた結果の例です。1,000 件の例だけで 1 エポック トレーニングすると、ほとんどの画像は植物ではないと高い確信を持つ一方で、どの画像が動物かについては不確かなモデルが得られます。 - チャート設定 + チャート設定 - チャート結果 + チャート結果 \ No newline at end of file diff --git a/ja/models/app/features/panels/parameter-importance.mdx b/ja/models/app/features/panels/parameter-importance.mdx index 043c37e1ed..2eea2ddad5 100644 --- a/ja/models/app/features/panels/parameter-importance.mdx +++ b/ja/models/app/features/panels/parameter-importance.mdx @@ -8,7 +8,7 @@ keywords: ["ハイパーパラメーター重要度", "特徴量重要度", "ラ パラメーター重要度パネルを使用すると、どのハイパーパラメーターが望ましいメトリクス値を最もよく予測し、かつ強く相関しているかを把握できます。このパネルを使って、今後のハイパーパラメーター探索では、モデル性能に最も大きく影響するパラメーターに注力してください。 - パラメーター重要度パネル + パラメーター重要度パネル **相関** は、ハイパーパラメーターと選択したメトリクス (この場合は `val_loss`) の線形相関を表します。相関が高い場合、ハイパーパラメーターの値が大きいほどメトリクスの値も大きくなり、その逆も成り立ちます。相関は有用なメトリクスですが、入力同士の二次的な相互作用は捉えられず、範囲の異なる入力を比較すると解釈が難しくなることがあります。 @@ -50,7 +50,7 @@ Workspace にハイパーパラメーター重要度パネルを追加するに 以下のセクションでは、次回の sweep で活用できるように、パネルに表示される重要度と相関の値の見方を説明します。 - 特徴量重要度の分析 + 特徴量重要度の分析 このパネルには、トレーニングスクリプトで [`wandb.Run.config`](/ja/models/track/config/) オブジェクトに渡されたすべてのパラメーターが表示されます。また、選択したモデルのメトリクス (この場合は `val_loss`) に対する、これらの設定パラメーターの特徴量重要度と相関が表示されます。 diff --git a/ja/models/app/features/panels/scatter-plot.mdx b/ja/models/app/features/panels/scatter-plot.mdx index e04e7d9bcb..a1f6304b93 100644 --- a/ja/models/app/features/panels/scatter-plot.mdx +++ b/ja/models/app/features/panels/scatter-plot.mdx @@ -29,7 +29,7 @@ W&B の散布図を使用すると、run を比較し、実験メトリク [実際の例を見る →](https://app.wandb.ai/l2k2/l2k/reports?view=carey%2FScatter%20Plot) - 検証精度の散布図 + 検証精度の散布図
diff --git a/ko/models/app/features/custom-charts/walkthrough.mdx b/ko/models/app/features/custom-charts/walkthrough.mdx index b29274b142..fd1c1ae490 100644 --- a/ko/models/app/features/custom-charts/walkthrough.mdx +++ b/ko/models/app/features/custom-charts/walkthrough.mdx @@ -66,7 +66,7 @@ with wandb.init() as run: 기본 시각화도 좋은 시작점이지만, Vega 스펙을 편집해 차트 유형을 바꾸고 제목을 추가하며 모양을 더 세밀하게 다듬을 수 있습니다. 산점도에서 선형 플롯으로 전환하려면 **Edit**를 클릭해 이 기본 제공 차트의 Vega 스펙을 변경하세요. [맞춤형 차트 데모 워크스페이스](https://app.wandb.ai/demo-team/custom-charts)에서 함께 따라 해보세요. - 맞춤형 차트 선택 + 맞춤형 차트 선택 시각화를 사용자 지정하도록 Vega 스펙을 업데이트하세요: @@ -82,7 +82,7 @@ with wandb.init() as run: 프리셋을 저장하면 프로젝트의 다른 Panel에서도 동일한 차트 설정을 재사용할 수 있습니다. 이 프로젝트의 다른 곳에서 사용할 수 있는 프리셋으로 저장하려면 페이지 상단의 **Save as**를 클릭하세요. 다음은 ROC 곡선과 함께 표시된 결과입니다. - PR 곡선 차트 + PR 곡선 차트
@@ -107,9 +107,9 @@ with wandb.init() as run: 다음은 간단한 실험의 예시 결과입니다. 예시 1,000개만으로 한 에포크 동안 트레이닝하면, 대부분의 이미지가 식물이 아니라는 점에는 확신하지만 어떤 이미지가 동물일 수 있는지에 대해서는 불확실한 모델이 생성됩니다. - 차트 설정 + 차트 설정 - 차트 결과 + 차트 결과 \ No newline at end of file diff --git a/ko/models/app/features/panels/parameter-importance.mdx b/ko/models/app/features/panels/parameter-importance.mdx index db2f7e8581..f14f02d3fc 100644 --- a/ko/models/app/features/panels/parameter-importance.mdx +++ b/ko/models/app/features/panels/parameter-importance.mdx @@ -8,7 +8,7 @@ keywords: ["하이퍼파라미터 중요도", "특성 중요도", "랜덤 포레 파라미터 중요도 패널은 어떤 하이퍼파라미터가 원하는 메트릭 값을 가장 잘 예측하고, 해당 값과 높은 상관관계를 보이는지 파악하는 데 도움이 됩니다. 이 패널을 사용해 이후 하이퍼파라미터 검색에서 모델 성능에 가장 큰 영향을 미치는 파라미터에 집중하세요. - 파라미터 중요도 패널 + 파라미터 중요도 패널 **Correlation**은 하이퍼파라미터와 선택한 메트릭(이 경우 `val_loss`) 사이의 선형 상관관계입니다. 상관관계가 높다는 것은 하이퍼파라미터 값이 높을수록 메트릭 값도 높아지고, 반대의 경우도 마찬가지라는 뜻입니다. 상관관계는 유용한 메트릭이지만 입력 간의 2차 상호작용은 포착할 수 없으며, 범위가 서로 다른 입력을 비교할 때는 해석이 복잡해질 수 있습니다. @@ -50,7 +50,7 @@ W&B는 **중요도** 메트릭도 계산합니다. W&B는 하이퍼파 다음 섹션에서는 패널에 표시된 중요도 및 상관관계 값을 읽는 방법을 설명하므로, 다음 스윕에서 이를 바탕으로 조치할 수 있습니다. - 특성 중요도 분석 + 특성 중요도 분석 이 패널에는 트레이닝 스크립트에서 [`wandb.Run.config`](/ko/models/track/config/) 객체로 전달된 모든 파라미터가 표시됩니다. 또한 선택한 모델 메트릭(이 경우 `val_loss`)을 기준으로 이러한 설정 파라미터의 특성 중요도와 상관관계를 보여줍니다. diff --git a/ko/models/app/features/panels/scatter-plot.mdx b/ko/models/app/features/panels/scatter-plot.mdx index 9896acc37d..cf97f903c8 100644 --- a/ko/models/app/features/panels/scatter-plot.mdx +++ b/ko/models/app/features/panels/scatter-plot.mdx @@ -29,7 +29,7 @@ W&B에서 산점도를 사용해 run을 비교하고 실험 메트릭 간의 [실시간 예시 보기 →](https://app.wandb.ai/l2k2/l2k/reports?view=carey%2FScatter%20Plot) - 검증 정확도 산점도 + 검증 정확도 산점도
diff --git a/models/app/features/custom-charts/walkthrough.mdx b/models/app/features/custom-charts/walkthrough.mdx index 48c6efc87d..50d54257c7 100644 --- a/models/app/features/custom-charts/walkthrough.mdx +++ b/models/app/features/custom-charts/walkthrough.mdx @@ -56,7 +56,7 @@ With the query in place, you can map your logged columns to the chart's visual e The default visualization is a good starting point, but you can edit the Vega spec to change the chart type, add titles, and refine the appearance. To switch from a scatter plot to a line plot, click **Edit** to change the Vega spec for this built-in chart. Follow along in the [custom charts demo workspace](https://app.wandb.ai/demo-team/custom-charts). - Custom chart selection + Custom chart selection Update the Vega spec to customize the visualization: @@ -72,7 +72,7 @@ Update the Vega spec to customize the visualization: Save a preset to reuse the same chart configuration on other panels in the project. To save this as a preset that you can use elsewhere in this project, click **Save as** at the top of the page. Here's what the result looks like, along with an ROC curve. - PR curve chart + PR curve chart ## Bonus: composite histograms @@ -95,9 +95,9 @@ To create your own version of the custom composite histogram panel: Here's an example result from a brief experiment: training on only 1,000 examples for one epoch yields a model that's confident that most images are not plants and uncertain about which images might be animals. - Chart configuration + Chart configuration - Chart result + Chart result \ No newline at end of file diff --git a/models/app/features/panels/parameter-importance.mdx b/models/app/features/panels/parameter-importance.mdx index af7248bb69..d9bdecb2e5 100644 --- a/models/app/features/panels/parameter-importance.mdx +++ b/models/app/features/panels/parameter-importance.mdx @@ -9,7 +9,7 @@ The parameter importance panel helps you discover which of your hyperparameters - Parameter importance panel + Parameter importance panel **Correlation** is the linear correlation between the hyperparameter and the chosen metric (in this case, `val_loss`). A high correlation means that when the hyperparameter has a higher value, the metric also has higher values, and vice versa. Correlation is a useful metric, but it can't capture second-order interactions between inputs, and it can get messy when you compare inputs with different ranges. @@ -49,7 +49,7 @@ With the parameter manager, you can manually set the visible and hidden paramete The following sections describe how to read the importance and correlation values shown in the panel so you can act on them in your next sweep. - Feature importance analysis + Feature importance analysis This panel shows you all the parameters passed to the [`wandb.Run.config`](/models/track/config/) object in your training script. It also shows the feature importances and correlations of these config parameters with respect to the model metric you select (`val_loss` in this case). diff --git a/models/app/features/panels/scatter-plot.mdx b/models/app/features/panels/scatter-plot.mdx index 5512e07568..ed1ea3d5ef 100644 --- a/models/app/features/panels/scatter-plot.mdx +++ b/models/app/features/panels/scatter-plot.mdx @@ -22,10 +22,10 @@ Use scatter plots to compare multiple runs and visualize the performance of an e The following example shows a scatter plot displaying validation accuracy for different models over several weeks of experimentation. The tooltip includes batch size, dropout, and axis values. A line also shows the running average of validation accuracy. -[See a live example →](https://app.wandb.ai/l2k2/l2k/reports?view=carey%2FScatter%20Plot) +[See a live example](https://app.wandb.ai/l2k2/l2k/reports?view=carey%2FScatter%20Plot) - Validation accuracy scatter plot + Validation accuracy scatter plot ## Create a scatter plot diff --git a/scripts/reference-generation/weave/generate_typescript_sdk_docs.py b/scripts/reference-generation/weave/generate_typescript_sdk_docs.py index 9373c4b287..4868d0f5a4 100755 --- a/scripts/reference-generation/weave/generate_typescript_sdk_docs.py +++ b/scripts/reference-generation/weave/generate_typescript_sdk_docs.py @@ -245,50 +245,490 @@ def _strip_redundant_optional_markers(content): return content -def _move_source_links_after_description(content): - """Move `Defined in: [...]` lines below the member's description. - - v4 places the source link between the signature and the description - text, so the description — the thing readers actually want — gets - pushed below the metadata. Relocate each source link to the end of its - block (just before the next heading, `***` separator, or end of file), - restoring the v3-era reading order: signature, description, source. +def _delink_and_unescape_type(text): + """Reduce a TypeDoc type expression to plain TypeScript text. + + TypeDoc renders types as a mix of code spans, markdown links, and + escaped punctuation (`` `Promise`\\<[`WeaveClient`](../interfaces/weaveclient)\\> ``). + JSX attributes and code fences need the plain form + (`Promise`). """ - lines = content.split('\n') - out = [] - pending = None - skip_blank = False - in_fence = False + text = re.sub(r'\[([^\]]+)\]\([^)]*\)', r'\1', text) + text = text.replace('`', '') + text = re.sub(r'\\([<>{}|_\[\]])', r'\1', text) + return ' '.join(text.split()) - def flush(): - nonlocal pending - if pending is not None: - if out and out[-1] != '': - out.append('') - out.append(pending) - out.append('') - pending = None +def _compact_type(plain, limit=60): + """Collapse brace bodies of an over-long type to `{…}` for display. + + Long inline object types (`Partial<{ attributes: Record; + ... }>`) would otherwise wrap across several lines inside a ParamField + type chip or a signature line. A type that collapses to nothing but + `{…}` is reported as `object`. + """ + # Innermost-out: collapsed bodies use a brace-free placeholder so the + # next pass can match the enclosing brace pair. + placeholder = '\x00' + while len(plain) > limit: + collapsed = re.sub(r'\{[^{}]*\}', placeholder, plain) + if collapsed == plain: + break + plain = collapsed + plain = plain.replace(placeholder, '{…}') + if plain in ('{…}', '{}'): + return 'object' + return plain + + +def _jsx_attr(value): + """Quote a string as a JSX attribute value.""" + if '"' in value: + if "'" in value: + value = value.replace('"', '’') + return f'"{value}"' + return f"'{value}'" + return f'"{value}"' + + +# A line is a type expression (rather than description prose) when it opens +# with a code span, a linked code span, an escaped inline-object brace, or a +# paren that starts type syntax: a quoted parameter, rest args, an empty +# list, or a parenthesized object/linked union. Prose like "(Optional) The +# host name..." opens its paren with a bare word and fails every branch. +_TYPE_LINE_RE = re.compile( + r'^(?:`|\[`|\\\{|\((?:`|\)|\\\{|\[|\(|\.\.\.)|(?:keyof|typeof|readonly|new) )' +) + +_PARAMS_HEADING_RE = re.compile(r'^(#{2,5}) Parameters$') + +# One-line call-signature blockquote on a function page: +# > **init**(`project`, `settings?`): `Promise`\<[`WeaveClient`](...)\> +# Property blockquotes (`> **callId**: `string``) have no paren list and +# don't match. +_CALL_SIG_RE = re.compile( + r'^> \*\*(?P[A-Za-z_$][\w$]*)\*\*(?P\\<.*?\\>)?' + r'\((?P[^)]*)\): (?P.+)$' +) + + +def _fence_mask(lines): + """Per-line flags: True while inside a fenced code block.""" + mask = [] + in_fence = False for line in lines: if line.lstrip().startswith('```'): in_fence = not in_fence - if not in_fence: - if skip_blank and line == '': - skip_blank = False - continue - skip_blank = False - if line.startswith('Defined in: ['): - flush() # consecutive source links (overloads): keep order - pending = line - skip_blank = True + mask.append(True) # fence delimiters count as inside + else: + mask.append(in_fence) + return mask + + +def _parse_param_entries(lines, mask, start, end, level): + """Parse one Parameters section body into param-entry dicts. + + Each entry heading sits at `level`; nested members (inline-expanded or + destructured object properties) sit one level deeper, where TypeDoc + also flattens deeper nesting into dotted names (`streamReducer.reduceFn`). + Returns a list of dicts with name/optional/type_line/description/members. + """ + head_re = re.compile(r'^#{%d} (.+)$' % level) + marks = [i for i in range(start, end) + if not mask[i] and head_re.match(lines[i])] + entries = [] + for n, i in enumerate(marks): + body_start = i + 1 + body_end = marks[n + 1] if n + 1 < len(marks) else end + raw_name = head_re.match(lines[i]).group(1).strip() + name = raw_name.replace('\\_', '_').replace('`', '') + optional = name.endswith('?') + name = name.rstrip('?') + + member_head_re = re.compile(r'^#{%d} .+$' % (level + 1)) + member_marks = [j for j in range(body_start, body_end) + if not mask[j] and member_head_re.match(lines[j])] + own_end = member_marks[0] if member_marks else body_end + + type_line = None + desc_lines = [] + for j in range(body_start, own_end): + line = lines[j] + if type_line is None and not desc_lines: + if line == '': + continue + if not mask[j] and _TYPE_LINE_RE.match(line): + type_line = line + continue + desc_lines.append(line if mask[j] else line.lstrip()) + while desc_lines and desc_lines[0] == '': + desc_lines.pop(0) + while desc_lines and desc_lines[-1] == '': + desc_lines.pop() + + members = (_parse_param_entries(lines, mask, member_marks[0], + body_end, level + 1) + if member_marks else []) + + entries.append({ + 'name': name, + 'optional': optional, + 'type_line': type_line, + 'description': desc_lines, + 'members': members, + }) + return entries + + +def _nest_dotted_members(members): + """Attach `parent.child` members beneath their `parent` entry. + + TypeDoc flattens second-level object nesting into dotted headings at + the same depth as the parent; ParamField/Expandable can express the + real hierarchy, so rebuild it. + """ + by_name = {} + nested = [] + for m in members: + if '.' in m['name']: + prefix, rest = m['name'].split('.', 1) + parent = by_name.get(prefix) + if parent is not None: + m = dict(m, name=rest) + parent['members'] = parent['members'] + [m] continue - if pending is not None and (line.startswith('#') or line == '***'): - flush() - out.append(line) - flush() + by_name[m['name']] = m + nested.append(m) + return nested + + +def _render_param_field(entry): + """Render one param entry (and nested members) as ParamField MDX lines.""" + type_line = entry['type_line'] + members = _nest_dotted_members(entry['members']) + + plain = _delink_and_unescape_type(type_line) if type_line else None + if plain is None and members: + plain = 'object' + compact = _compact_type(plain) if plain else None + + attrs = f' path={_jsx_attr(entry["name"])}' + if compact: + attrs += f' type={_jsx_attr(compact)}' + if not entry['optional']: + attrs += ' required' + + body = [] + if entry['description']: + body.extend(entry['description']) + + # Keep navigability the type chip can't express: cross-reference links + # from the original type expression, and the full text of a type that + # was abbreviated for display. + if type_line: + links = re.findall(r'\[`?([^`\]]+)`?\]\(([^)]+)\)', type_line) + if links: + refs = ', '.join(f'[`{label}`]({href})' for label, href in links) + body.extend(['', f'See {refs}.'] if body else [f'See {refs}.']) + if compact and plain != compact: + note = f'Full type: `{plain}`' + body.extend(['', note] if body else [note]) + + if members: + exp = [''] + for i, m in enumerate(members): + if i: + exp.append('') + exp.extend(f' {l}' if l else '' for l in _render_param_field(m)) + exp.append('') + body.extend([''] + exp if body else exp) + + if not body: + return [f''] + lines = [f''] + lines.extend(f' {b}' if b else '' for b in body) + lines.append('') + return lines + + +def _convert_parameters_sections_to_paramfields(content): + """Rewrite every `Parameters` section from floating headings to + Mintlify markup. + + TypeDoc renders each parameter as a bare heading with an orphaned type + line below it, which reads as disconnected fragments and pollutes the + on-page TOC with per-parameter anchors. ParamField renders the + name/type/required row these sections actually are; inline-expanded or + destructured members nest inside an . Optionality is shown + by the absence of the `required` badge (plus the `?` in the signature + code block), matching OpenAPI-reference convention. + """ + lines = content.split('\n') + mask = _fence_mask(lines) + out = [] + i = 0 + while i < len(lines): + m = None if mask[i] else _PARAMS_HEADING_RE.match(lines[i]) + if not m: + out.append(lines[i]) + i += 1 + continue + level = len(m.group(1)) + end_re = re.compile(r'^#{1,%d} ' % level) + end = len(lines) + for j in range(i + 1, len(lines)): + if not mask[j] and (end_re.match(lines[j]) or lines[j] == '***'): + end = j + break + entries = _parse_param_entries(lines, mask, i + 1, end, level + 1) + if not entries: + out.append(lines[i]) + i += 1 + continue + out.append(lines[i]) + out.append('') + for n, entry in enumerate(entries): + if n: + out.append('') + out.extend(_render_param_field(entry)) + out.append('') + i = end + return '\n'.join(out) + + +_TYPE_PARAMS_HEADING_RE = re.compile(r'^(#{2,5}) Type Parameters$') + + +def _section_end(lines, mask, start, level): + """Index of the line that ends a section opened by a heading at `level`: + the next heading at the same or shallower level, a `***` member + separator, or end of file.""" + end_re = re.compile(r'^#{1,%d} ' % level) + for j in range(start, len(lines)): + if not mask[j] and (end_re.match(lines[j]) or lines[j] == '***'): + return j + return len(lines) + + +def _convert_type_parameters_sections(content): + """Rewrite `Type Parameters` sections into rows. + + TypeDoc emits one heading per type parameter with its constraint below + as chip fragments — and for an unconstrained parameter the "constraint" + is just the name again (`### T` followed by a lone `T` chip). Render a + single row instead: the name, with `extends ...` as the type text when + a constraint exists and nothing when there isn't one. No required + badge — optionality doesn't apply to generics. + """ + lines = content.split('\n') + mask = _fence_mask(lines) + out = [] + i = 0 + while i < len(lines): + m = None if mask[i] else _TYPE_PARAMS_HEADING_RE.match(lines[i]) + if not m: + out.append(lines[i]) + i += 1 + continue + level = len(m.group(1)) + end = _section_end(lines, mask, i + 1, level) + entries = _parse_param_entries(lines, mask, i + 1, end, level + 1) + if not entries: + out.append(lines[i]) + i += 1 + continue + out.append(lines[i]) + out.append('') + for n, entry in enumerate(entries): + if n: + out.append('') + type_attr = None + if entry['type_line']: + plain = _delink_and_unescape_type( + entry['type_line'].replace('*extends*', 'extends')) + if plain != entry['name']: + prefix = entry['name'] + ' ' + if plain.startswith(prefix): + plain = plain[len(prefix):] + type_attr = _compact_type(plain) + attrs = f' path={_jsx_attr(entry["name"])}' + if type_attr: + attrs += f' type={_jsx_attr(type_attr)}' + desc = entry['description'] + if not desc: + out.append(f'') + else: + out.append(f'') + out.extend(f' {d}' if d else '' for d in desc) + out.append('') + out.append('') + i = end return '\n'.join(out) +_RETURNS_HEADING_RE = re.compile(r'^(#{2,5}) Returns$') + +# Property signature blockquote: `> `optional` **displayName**: `string``. +# The leading tags (`optional`, `readonly`, ...) are TypeDoc modifier chips. +_PROP_SIG_RE = re.compile(r'^> ((?:`[a-z]+` )*)\*\*([^*~]+)\*\*: (.+)$') + + +def _convert_returns_members_to_responsefields(content): + """Rewrite documented members of an object return type into + rows. + + A function returning an anonymous object gets one heading per member + under `Returns`, each holding a property-signature blockquote — + Mintlify renders those as quote bars, which reads as a misplaced + callout. ResponseField is the ParamField sibling purpose-built for + return payloads; the same badge policy applies (always-present members + get `required`, optional ones are unbadged). Sections where any member + doesn't parse cleanly (e.g. deprecated strikethrough names) are left + untouched rather than half-converted. + """ + lines = content.split('\n') + mask = _fence_mask(lines) + out = [] + i = 0 + while i < len(lines): + m = None if mask[i] else _RETURNS_HEADING_RE.match(lines[i]) + if not m: + out.append(lines[i]) + i += 1 + continue + level = len(m.group(1)) + end = _section_end(lines, mask, i + 1, level) + head_re = re.compile(r'^#{%d} (.+)$' % (level + 1)) + marks = [j for j in range(i + 1, end) + if not mask[j] and head_re.match(lines[j])] + if not marks: + out.append(lines[i]) + i += 1 + continue + + fields = [] + parsed_all = True + for n, j in enumerate(marks): + body_end = marks[n + 1] if n + 1 < len(marks) else end + name = head_re.match(lines[j]).group(1).strip() + name = name.replace('\\_', '_').rstrip('?') + sig = None + desc = [] + for k in range(j + 1, body_end): + pm = None if mask[k] else _PROP_SIG_RE.match(lines[k]) + if sig is None and pm: + sig = pm + continue + desc.append(lines[k] if mask[k] else lines[k].lstrip()) + if sig is None or '~~' in name: + parsed_all = False + break + while desc and desc[0] == '': + desc.pop(0) + while desc and desc[-1] == '': + desc.pop() + optional = '`optional`' in sig.group(1) + type_attr = _compact_type(_delink_and_unescape_type(sig.group(3))) + attrs = f' name={_jsx_attr(name)} type={_jsx_attr(type_attr)}' + if not optional: + attrs += ' required' + if desc: + field = [f''] + field.extend(f' {d}' if d else '' for d in desc) + field.append('') + else: + field = [f''] + fields.append(field) + + if not parsed_all: + out.append(lines[i]) + i += 1 + continue + + # Keep the section prefix (the `object` type chip and any + # description) as-is, then emit the converted member rows. + out.append(lines[i]) + out.extend(lines[i + 1:marks[0]]) + if out and out[-1] != '': + out.append('') + for n, field in enumerate(fields): + if n: + out.append('') + out.extend(field) + out.append('') + i = end + return '\n'.join(out) + + +def _convert_function_signatures_to_code_blocks(content): + """Replace call-signature blockquotes with syntax-highlighted fences. + + The signature is the most important element on a function page, but + TypeDoc renders it as a blockquote of mixed bold text and code chips. + Emit a ```ts fence instead, enriching each parameter with its + (display-compacted) type from the Parameters section that follows the + signature — the blockquote itself only carries parameter names. + Twoslash is deliberately not enabled: a bare signature is not a valid + standalone statement. + """ + lines = content.split('\n') + mask = _fence_mask(lines) + + sig_indices = [i for i, line in enumerate(lines) + if not mask[i] and _CALL_SIG_RE.match(line)] + if not sig_indices: + return content + + # Map each signature to the Parameters section that documents it: the + # first one after the signature and before the next signature (an + # overloaded function page repeats signature/Parameters pairs). + types_for_sig = {} + for n, i in enumerate(sig_indices): + limit = sig_indices[n + 1] if n + 1 < len(sig_indices) else len(lines) + for j in range(i + 1, limit): + m = None if mask[j] else _PARAMS_HEADING_RE.match(lines[j]) + if not m: + continue + level = len(m.group(1)) + end_re = re.compile(r'^#{1,%d} ' % level) + end = limit + for k in range(j + 1, limit): + if not mask[k] and (end_re.match(lines[k]) or lines[k] == '***'): + end = k + break + entries = _parse_param_entries(lines, mask, j + 1, end, level + 1) + types_for_sig[i] = {e['name']: e for e in entries} + break + + for i in sig_indices: + m = _CALL_SIG_RE.match(lines[i]) + gen = _delink_and_unescape_type(m.group('gen')) if m.group('gen') else '' + ret = _compact_type(_delink_and_unescape_type(m.group('ret')), limit=80) + entry_by_name = types_for_sig.get(i, {}) + + rendered_params = [] + for raw in re.findall(r'`([^`]+)`', m.group('params')): + pname = raw.rstrip('?').replace('\\_', '_') + suffix = '?' if raw.endswith('?') else '' + entry = entry_by_name.get(pname) + ptype = None + if entry: + if entry['type_line']: + ptype = _compact_type( + _delink_and_unescape_type(entry['type_line'])) + elif entry['members']: + ptype = 'object' + rendered = f'{pname}{suffix}' + if ptype: + rendered += f': {ptype}' + rendered_params.append(rendered) + + signature = f"{m.group('name')}{gen}({', '.join(rendered_params)}): {ret}" + lines[i] = f'```ts\n{signature}\n```' + + return '\n'.join(lines) + + def convert_to_mintlify_format(docs_dir): """Convert TypeDoc markdown to Mintlify MDX format.""" print(f"\nConverting to Mintlify format...") @@ -349,10 +789,12 @@ def convert_to_mintlify_format(docs_dir): # prepended (the quoted YAML title must keep its bare < and >). content = _escape_mdx_hostile_chars(content) - # De-duplicate v4's optional markers and restore the - # signature → description → source-link reading order. + # De-duplicate v4's optional markers. (Source links used to be + # relocated below descriptions here for reading order; now that + # they render as right-floated SourceLink buttons they stay where + # TypeDoc puts them — directly after the signature — and float to + # the top right of the section without interrupting text flow.) content = _strip_redundant_optional_markers(content) - content = _move_source_links_after_description(content) # Add Mintlify frontmatter frontmatter = f"""--- @@ -465,6 +907,45 @@ def _dedupe_collision_link_label(m): content, ) + # Visual restructuring passes. These run last so the markup they + # emit (JSX components, plain-TS code fences) is exempt from the + # escaping/twoslash/link rewrites above, while the prose they carry + # along has already been through them. + if title.startswith("Function:"): + content = _convert_function_signatures_to_code_blocks(content) + content = _convert_parameters_sections_to_paramfields(content) + content = _convert_type_parameters_sections(content) + content = _convert_returns_members_to_responsefields(content) + + # Render source-link metadata with the site's shared SourceLink + # button (a compact right-floated pill, styled by `.source-link` in + # css/styles.css) instead of an inline text line. The import is only + # added when a link was actually converted. + content, n_source_links = re.subn( + r'^Defined in: \[[^\]]+\]\(([^)\s]+)\)$', + r'', + content, + flags=re.MULTILINE, + ) + if n_source_links: + content = re.sub( + r'\A(---\n.*?\n---\n)', + r"\1\nimport { SourceLink } from '/snippets/_includes/source-link.mdx';\n", + content, + count=1, + flags=re.DOTALL, + ) + + # Linkless source lines (members inherited from TypeScript's own + # lib .d.ts files carry no GitHub URL) can't become buttons; keep + # them but at metadata weight. + content = re.sub( + r'^Defined in: (.+)$', + r'Source: \1', + content, + flags=re.MULTILINE, + ) + # Write as .mdx file with lowercase filename (avoid Git case sensitivity issues) lowercase_stem = md_file.stem.lower() mdx_file = md_file.parent / f"{lowercase_stem}.mdx" @@ -934,7 +1415,7 @@ def main(): original_cwd = os.getcwd() # Download Weave source - weave_source = download_weave_source(weave_version) + weave_source = download_weave_source("drtangible/wip-test-inline-tag") try: # Set up TypeScript project diff --git a/weave/reference/typescript-sdk.mdx b/weave/reference/typescript-sdk.mdx index 816a1d18d7..7ace8d1bc9 100644 --- a/weave/reference/typescript-sdk.mdx +++ b/weave/reference/typescript-sdk.mdx @@ -21,6 +21,7 @@ description: "TypeScript SDK reference" - [CallsFilter](./typescript-sdk/interfaces/callsfilter) - [Conversation](./typescript-sdk/interfaces/conversation) - [ConversationInit](./typescript-sdk/interfaces/conversationinit) +- [CustomRuntimeId](./typescript-sdk/interfaces/customruntimeid) - [GetAgentsOptions](./typescript-sdk/interfaces/getagentsoptions) - [GetAgentSpansOptions](./typescript-sdk/interfaces/getagentspansoptions) - [GetAgentTurnOptions](./typescript-sdk/interfaces/getagentturnoptions) @@ -34,10 +35,12 @@ description: "TypeScript SDK reference" - [Message](./typescript-sdk/interfaces/message) - [Query](./typescript-sdk/interfaces/query) - [Reasoning](./typescript-sdk/interfaces/reasoning) +- [RegisterCustomRuntimeOptions](./typescript-sdk/interfaces/registercustomruntimeoptions) - [SortBy](./typescript-sdk/interfaces/sortby) - [SubAgent](./typescript-sdk/interfaces/subagent) - [SubAgentInit](./typescript-sdk/interfaces/subagentinit) - [Tool](./typescript-sdk/interfaces/tool) +- [ToolEndOptions](./typescript-sdk/interfaces/toolendoptions) - [ToolInit](./typescript-sdk/interfaces/toolinit) - [Turn](./typescript-sdk/interfaces/turn) - [TurnInit](./typescript-sdk/interfaces/turninit) @@ -58,10 +61,13 @@ description: "TypeScript SDK reference" - [GetAgentTurnResult](./typescript-sdk/type-aliases/getagentturnresult) - [GetAgentTurnsResult](./typescript-sdk/type-aliases/getagentturnsresult) - [GetAgentVersionsResult](./typescript-sdk/type-aliases/getagentversionsresult) +- [JsonObject](./typescript-sdk/type-aliases/jsonobject) +- [JsonValue](./typescript-sdk/type-aliases/jsonvalue) - [MessagePart](./typescript-sdk/type-aliases/messagepart) - [Modality](./typescript-sdk/type-aliases/modality) - [Op](./typescript-sdk/type-aliases/op) - [OpDecorator](./typescript-sdk/type-aliases/opdecorator) +- [RegisterCustomRuntimeResult](./typescript-sdk/type-aliases/registercustomruntimeresult) - [Response](./typescript-sdk/type-aliases/response) - [Role](./typescript-sdk/type-aliases/role) - [~~Session~~](./typescript-sdk/type-aliases/session) @@ -81,6 +87,7 @@ description: "TypeScript SDK reference" - [endConversation](./typescript-sdk/functions/endconversation) - [endLLM](./typescript-sdk/functions/endllm) - [endTurn](./typescript-sdk/functions/endturn) +- [flush](./typescript-sdk/functions/flush) - [flushOTel](./typescript-sdk/functions/flushotel) - [getCurrentConversation](./typescript-sdk/functions/getcurrentconversation) - [getCurrentLLM](./typescript-sdk/functions/getcurrentllm) diff --git a/weave/reference/typescript-sdk/classes/dataset.mdx b/weave/reference/typescript-sdk/classes/dataset.mdx index d09e8f3111..431d800b9a 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" --- -Dataset object with easy saving and automatic versioning +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -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 @@ -34,9 +36,7 @@ const ref = await dataset.save() ## Type Parameters -### R - -`R` *extends* `DatasetRow` + ## Constructors @@ -44,13 +44,19 @@ const ref = await dataset.save() > **new Dataset**\<`R`\>(`parameters`): `Dataset`\<`R`\> -Defined in: [src/dataset.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L55) + #### Parameters -##### parameters + + + -`DatasetParameters`\<`R`\> + + + + + #### Returns @@ -66,7 +72,7 @@ Defined in: [src/dataset.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c > `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) + #### Inherited from @@ -78,7 +84,7 @@ Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077e > **rows**: `Table`\<`R`\> -Defined in: [src/dataset.ts:53](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L53) + ## Accessors @@ -88,7 +94,7 @@ Defined in: [src/dataset.ts:53](https://github.com/wandb/weave/blob/8c5f077eb11c > **get** **description**(): `string` \| `undefined` -Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) + ##### Returns @@ -106,7 +112,7 @@ Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077e > **get** **length**(): `number` -Defined in: [src/dataset.ts:68](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L68) + ##### Returns @@ -120,7 +126,7 @@ Defined in: [src/dataset.ts:68](https://github.com/wandb/weave/blob/8c5f077eb11c > **get** **name**(): `string` -Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) + ##### Returns @@ -136,7 +142,7 @@ Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077e > **\[asyncIterator\]**(): `AsyncIterator`\<`any`\> -Defined in: [src/dataset.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L72) + #### Returns @@ -148,13 +154,11 @@ Defined in: [src/dataset.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c > **getRow**(`index`): `R` -Defined in: [src/dataset.ts:78](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L78) + #### Parameters -##### index - -`number` + #### Returns @@ -166,7 +170,7 @@ Defined in: [src/dataset.ts:78](https://github.com/wandb/weave/blob/8c5f077eb11c > **save**(): `Promise`\<[`ObjectRef`](./objectref)\> -Defined in: [src/dataset.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/dataset.ts#L64) + #### Returns @@ -178,7 +182,7 @@ Defined in: [src/dataset.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c > **saveAttrs**(): `object` -Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) + #### Returns diff --git a/weave/reference/typescript-sdk/classes/evaluation.mdx b/weave/reference/typescript-sdk/classes/evaluation.mdx index 3538eaa7b1..9cb85cf025 100644 --- a/weave/reference/typescript-sdk/classes/evaluation.mdx +++ b/weave/reference/typescript-sdk/classes/evaluation.mdx @@ -3,6 +3,10 @@ title: "Evaluation" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + 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,8 +14,6 @@ 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. -Defined in: [src/evaluation.ts:139](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L139) - ## Example ```ts twoslash @@ -52,17 +54,11 @@ const results = await evaluation.evaluate({ model }); ## Type Parameters -### R - -`R` *extends* `DatasetRow` - -### E + -`E` *extends* `DatasetRow` + -### M - -`M` + ## Constructors @@ -70,13 +66,35 @@ const results = await evaluation.evaluate({ model }); > **new Evaluation**\<`R`, `E`, `M`\>(`parameters`): `Evaluation`\<`R`, `E`, `M`\> -Defined in: [src/evaluation.ts:150](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L150) + #### Parameters -##### parameters + + + + + + + + + + See [`Dataset`](./dataset). + + + + + -`EvaluationParameters`\<`R`, `E`, `M`\> + + + + See [`Op`](../type-aliases/op). + + Full type: `(Op<(...args) => any> | { id: string; invoke: (...args) => any; })[]` + + + #### Returns @@ -92,7 +110,7 @@ Defined in: [src/evaluation.ts:150](https://github.com/wandb/weave/blob/8c5f077e > `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) + #### Inherited from @@ -106,7 +124,7 @@ Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077e > **get** **description**(): `string` \| `undefined` -Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) + ##### Returns @@ -124,7 +142,7 @@ Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077e > **get** **name**(): `string` -Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) + ##### Returns @@ -140,23 +158,23 @@ Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077e > **evaluate**(`__namedParameters`): `Promise`\<`Record`\<`string`, `any`\>\> -Defined in: [src/evaluation.ts:165](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L165) + #### Parameters -##### \_\_namedParameters - -###### maxConcurrency? - -`number` = `5` + + + -###### model + + See [`Op`](../type-aliases/op). -`WeaveCallable`\<(...`args`) => `Promise`\<`M`\>\> + Full type: `Op<(...args) => Promise> | { id: string; invoke: (...args) => Promise; }` + -###### nTrials? - -`number` = `1` + + + #### Returns @@ -168,23 +186,27 @@ Defined in: [src/evaluation.ts:165](https://github.com/wandb/weave/blob/8c5f077e > **predictAndScore**(`__namedParameters`): `Promise`\<\{ `model_latency`: `number`; `model_output`: `any`; `model_success`: `boolean`; `scores`: \{\[`key`: `string`\]: `any`; \}; \}\> -Defined in: [src/evaluation.ts:244](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L244) + #### Parameters -##### \_\_namedParameters - -###### columnMapping? - -`ColumnMapping`\<`R`, `E`\> - -###### example + + + + + + + -`R` + -###### model + + See [`Op`](../type-aliases/op). -`WeaveCallable`\<(...`args`) => `Promise`\<`M`\>\> + Full type: `Op<(...args) => Promise> | { id: string; invoke: (...args) => Promise; }` + + + #### Returns @@ -196,7 +218,7 @@ Defined in: [src/evaluation.ts:244](https://github.com/wandb/weave/blob/8c5f077e > **saveAttrs**(): `object` -Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) + #### Returns diff --git a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx index 02c354aa4c..45166effbd 100644 --- a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx +++ b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx @@ -3,13 +3,15 @@ title: "EvaluationLogger" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + 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. -Defined in: [src/evaluationLogger.ts:554](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L554) - ## Example ```ts twoslash @@ -35,13 +37,29 @@ await ev.logSummary(); > **new EvaluationLogger**(`options`): `EvaluationLogger` -Defined in: [src/evaluationLogger.ts:573](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L573) + #### Parameters -##### options + + + + + + See [`Dataset`](./dataset). + + + -`EvaluationLoggerOptions` + + See [`WeaveObject`](./weaveobject). + + + + + + + #### Returns @@ -53,6 +71,8 @@ Defined in: [src/evaluationLogger.ts:573](https://github.com/wandb/weave/blob/8c > **logPrediction**(`inputs`, `output`): [`ScoreLogger`](./scorelogger) + + Log a prediction with its input and output (synchronous version). Creates a predict_and_score call (with child predict call). Returns a ScoreLogger immediately for adding scores. @@ -60,17 +80,11 @@ Returns a ScoreLogger immediately for adding scores. This method returns the ScoreLogger synchronously. Operations on the ScoreLogger (logScore, finish) will be queued and executed when initialization completes. -Defined in: [src/evaluationLogger.ts:660](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L660) - #### Parameters -##### inputs + -`Record`\<`string`, `any`\> - -##### output - -`any` + #### Returns @@ -93,23 +107,19 @@ await evalLogger.logSummary(); // Waits for everything > **logPredictionAsync**(`inputs`, `output`): `Promise`\<[`ScoreLogger`](./scorelogger)\> + + Log a prediction with its input and output (async version). Like logPrediction() but returns a Promise that resolves when the prediction call is fully initialized. Use this if you need to await the initialization before proceeding. -Defined in: [src/evaluationLogger.ts:685](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L685) - #### Parameters -##### inputs - -`Record`\<`string`, `any`\> + -##### output - -`any` + #### Returns @@ -131,19 +141,17 @@ await scoreLogger.finish(); > **logSummary**(`summary?`): `Promise`\<`void`\> + + Log a summary and finalize the evaluation. Creates a summarize call and finishes the evaluate call. This method can be called without await (fire-and-forget), but internally it will wait for all pending operations to complete. -Defined in: [src/evaluationLogger.ts:786](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L786) - #### Parameters -##### summary? - -`Record`\<`string`, `any`\> + #### Returns diff --git a/weave/reference/typescript-sdk/classes/messagesprompt.mdx b/weave/reference/typescript-sdk/classes/messagesprompt.mdx index a04ff89cea..65b47f22d4 100644 --- a/weave/reference/typescript-sdk/classes/messagesprompt.mdx +++ b/weave/reference/typescript-sdk/classes/messagesprompt.mdx @@ -3,7 +3,9 @@ title: "MessagesPrompt" description: "TypeScript SDK reference" --- -Defined in: [src/prompt.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L41) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,13 +17,19 @@ Defined in: [src/prompt.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c4 > **new MessagesPrompt**(`parameters`): `MessagesPrompt` -Defined in: [src/prompt.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L44) + #### Parameters -##### parameters + + + + + -`MessagesPromptParameters` + + + #### Returns @@ -37,7 +45,7 @@ Defined in: [src/prompt.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c4 > `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) + #### Inherited from @@ -49,7 +57,7 @@ Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077e > **messages**: `Record`\<`string`, `any`\>[] -Defined in: [src/prompt.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L42) + ## Accessors @@ -59,7 +67,7 @@ Defined in: [src/prompt.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c4 > **get** **description**(): `string` \| `undefined` -Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) + ##### Returns @@ -77,7 +85,7 @@ Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077e > **get** **name**(): `string` -Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) + ##### Returns @@ -93,13 +101,11 @@ Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077e > **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 -##### values? - -`Record`\<`string`, `any`\> = `{}` + #### Returns @@ -111,7 +117,7 @@ Defined in: [src/prompt.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c4 > **saveAttrs**(): `object` -Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) + #### Returns @@ -127,17 +133,15 @@ Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077e > `static` **get**(`client`, `uri`): `Promise`\<`MessagesPrompt`\> -Defined in: [src/prompt.ts:77](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L77) + #### Parameters -##### client + + See [`WeaveClient`](../interfaces/weaveclient). + -[`WeaveClient`](../interfaces/weaveclient) - -##### uri - -`string` + #### Returns diff --git a/weave/reference/typescript-sdk/classes/objectref.mdx b/weave/reference/typescript-sdk/classes/objectref.mdx index 4c8c81270a..ac9de4485f 100644 --- a/weave/reference/typescript-sdk/classes/objectref.mdx +++ b/weave/reference/typescript-sdk/classes/objectref.mdx @@ -3,6 +3,10 @@ title: "ObjectRef" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + Represents a reference to a saved Weave object. Generally, end users will not need to interact with this class directly. @@ -10,8 +14,6 @@ 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. -Defined in: [src/weaveObject.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L23) - ## Example ```ts twoslash @@ -26,21 +28,15 @@ const uri = ref.uri(); // weave:///my-project/object/abc123:def456 > **new ObjectRef**(`projectId`, `objectId`, `digest`): `ObjectRef` -Defined in: [src/weaveObject.ts:24](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L24) + #### Parameters -##### projectId - -`string` - -##### objectId - -`string` + -##### digest + -`string` + #### Returns @@ -52,7 +48,7 @@ Defined in: [src/weaveObject.ts:24](https://github.com/wandb/weave/blob/8c5f077e > **digest**: `string` -Defined in: [src/weaveObject.ts:27](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L27) + *** @@ -60,7 +56,7 @@ Defined in: [src/weaveObject.ts:27](https://github.com/wandb/weave/blob/8c5f077e > **objectId**: `string` -Defined in: [src/weaveObject.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L26) + *** @@ -68,7 +64,7 @@ Defined in: [src/weaveObject.ts:26](https://github.com/wandb/weave/blob/8c5f077e > **projectId**: `string` -Defined in: [src/weaveObject.ts:25](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L25) + ## Methods @@ -76,7 +72,7 @@ Defined in: [src/weaveObject.ts:25](https://github.com/wandb/weave/blob/8c5f077e > **get**(): `Promise`\<`any`\> -Defined in: [src/weaveObject.ts:64](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L64) + #### Returns @@ -88,7 +84,7 @@ Defined in: [src/weaveObject.ts:64](https://github.com/wandb/weave/blob/8c5f077e > **ui\_url**(): `string` -Defined in: [src/weaveObject.ts:59](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L59) + #### Returns @@ -100,7 +96,7 @@ Defined in: [src/weaveObject.ts:59](https://github.com/wandb/weave/blob/8c5f077e > **uri**(): `string` -Defined in: [src/weaveObject.ts:55](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L55) + #### Returns @@ -112,17 +108,15 @@ Defined in: [src/weaveObject.ts:55](https://github.com/wandb/weave/blob/8c5f077e > `static` **fromUri**(`uri`): `ObjectRef` -Creates an ObjectRef from a Weave URI string. + -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 -##### uri - -`string` - -A Weave URI in the format: weave:///entity/project/object/name:digest + + A Weave URI in the format: weave:///entity/project/object/name:digest + #### Returns diff --git a/weave/reference/typescript-sdk/classes/scorelogger.mdx b/weave/reference/typescript-sdk/classes/scorelogger.mdx index 5f374b7860..7ef62518df 100644 --- a/weave/reference/typescript-sdk/classes/scorelogger.mdx +++ b/weave/reference/typescript-sdk/classes/scorelogger.mdx @@ -3,11 +3,13 @@ title: "ScoreLogger" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + ScoreLogger manages scoring for a single prediction. Returned from EvaluationLogger.logPrediction(). -Defined in: [src/evaluationLogger.ts:330](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L330) - ## Example ```ts twoslash @@ -24,13 +26,13 @@ await pred.finish(); // Finalizes the prediction > **new ScoreLogger**(`evalLogger`): `ScoreLogger` -Defined in: [src/evaluationLogger.ts:338](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L338) + #### Parameters -##### evalLogger - -[`EvaluationLogger`](./evaluationlogger) + + See [`EvaluationLogger`](./evaluationlogger). + #### Returns @@ -44,11 +46,11 @@ Defined in: [src/evaluationLogger.ts:338](https://github.com/wandb/weave/blob/8c > **get** **isFinishCalled**(): `boolean` + + Check if finish() has been called. Used by EvaluationLogger to detect unfinished predictions. -Defined in: [src/evaluationLogger.ts:368](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L368) - ##### Returns `boolean` @@ -59,12 +61,12 @@ Defined in: [src/evaluationLogger.ts:368](https://github.com/wandb/weave/blob/8c > **finish**(): `Promise`\<`void`\> + + Finish the scoring process for the prediction. Finalizes the predict_and_score call with accumulated scores. Updates incremental aggregates and frees memory. -Defined in: [src/evaluationLogger.ts:470](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L470) - #### Returns `Promise`\<`void`\> @@ -75,24 +77,20 @@ Defined in: [src/evaluationLogger.ts:470](https://github.com/wandb/weave/blob/8c > **logScore**(`scorerName`, `score`): `Promise`\<`void`\> + + Log a score for this prediction. Creates a scorer call as a child of predict_and_score. -Defined in: [src/evaluationLogger.ts:379](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluationLogger.ts#L379) - #### Parameters -##### scorerName - -`string` - -Name of the scorer (e.g., "accuracy", "f1_score") - -##### score - -`any` + + Name of the scorer (e.g., "accuracy", "f1_score") + -The score value + + The score value + #### Returns diff --git a/weave/reference/typescript-sdk/classes/stringprompt.mdx b/weave/reference/typescript-sdk/classes/stringprompt.mdx index 811d91e0ad..2567ee506d 100644 --- a/weave/reference/typescript-sdk/classes/stringprompt.mdx +++ b/weave/reference/typescript-sdk/classes/stringprompt.mdx @@ -3,7 +3,9 @@ title: "StringPrompt" description: "TypeScript SDK reference" --- -Defined in: [src/prompt.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L18) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,13 +17,19 @@ Defined in: [src/prompt.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c4 > **new StringPrompt**(`parameters`): `StringPrompt` -Defined in: [src/prompt.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L21) + #### Parameters -##### parameters + + + + + -`StringPromptParameters` + + + #### Returns @@ -37,7 +45,7 @@ Defined in: [src/prompt.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c4 > `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) + #### Inherited from @@ -49,7 +57,7 @@ Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077e > **content**: `string` -Defined in: [src/prompt.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L19) + ## Accessors @@ -59,7 +67,7 @@ Defined in: [src/prompt.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c4 > **get** **description**(): `string` \| `undefined` -Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) + ##### Returns @@ -77,7 +85,7 @@ Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077e > **get** **name**(): `string` -Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) + ##### Returns @@ -93,13 +101,11 @@ Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077e > **format**(`values?`): `string` -Defined in: [src/prompt.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L26) + #### Parameters -##### values? - -`Record`\<`string`, `any`\> = `{}` + #### Returns @@ -111,7 +117,7 @@ Defined in: [src/prompt.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c4 > **saveAttrs**(): `object` -Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) + #### Returns @@ -127,17 +133,15 @@ Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077e > `static` **get**(`client`, `uri`): `Promise`\<`StringPrompt`\> -Defined in: [src/prompt.ts:30](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/prompt.ts#L30) + #### Parameters -##### client + + See [`WeaveClient`](../interfaces/weaveclient). + -[`WeaveClient`](../interfaces/weaveclient) - -##### uri - -`string` + #### Returns diff --git a/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx b/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx index 329c031f59..eb72a81e3f 100644 --- a/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx +++ b/weave/reference/typescript-sdk/classes/weaveadkplugin.mdx @@ -3,6 +3,10 @@ title: "WeaveAdkPlugin" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + ADK plugin that emits runner invocations, agent runs, model calls and tool executions as GenAI-semconv OTel spans on Weave's agents pipeline. @@ -11,8 +15,6 @@ invokes every callback, so all are present even where a callback is a no-op. ADK treats any non-`undefined` return as a short-circuit, so every callback swallows its own errors and returns `undefined`. -Defined in: [src/integrations/googleAdk.ts:589](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L589) - ## Implements - `BasePlugin` @@ -33,7 +35,7 @@ Defined in: [src/integrations/googleAdk.ts:589](https://github.com/wandb/weave/b > `readonly` **name**: `"weave"` = `WEAVE_ADK_PLUGIN_NAME` -Defined in: [src/integrations/googleAdk.ts:590](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L590) + #### Implementation of @@ -45,28 +47,26 @@ Defined in: [src/integrations/googleAdk.ts:590](https://github.com/wandb/weave/b > **afterAgentCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed after an agent's primary logic has completed. This callback can be used to inspect, log, or modify the agent's final result before it is returned. -Defined in: [src/integrations/googleAdk.ts:779](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L779) - #### Parameters -##### params - -###### agent - -`BaseAgent` + + + + The agent that has just run. + -The agent that has just run. - -###### callbackContext - -`Context` - -The context for the agent invocation. + + The context for the agent invocation. + + + #### Returns @@ -86,18 +86,16 @@ An optional `Content` object. If a value is returned, it will > **afterContextCompaction**(`_params`): `Promise`\<`undefined`\> + + Callback executed after context compaction. This callback provides an opportunity to inspect the context after it has been compacted. -Defined in: [src/integrations/googleAdk.ts:997](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L997) - #### Parameters -##### \_params - -`unknown` + #### Returns @@ -113,28 +111,26 @@ Defined in: [src/integrations/googleAdk.ts:997](https://github.com/wandb/weave/b > **afterModelCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed after a response is received from the model. This is the ideal place to log model responses, collect metrics on token usage, or perform post-processing on the raw `LlmResponse`. -Defined in: [src/integrations/googleAdk.ts:841](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L841) - #### Parameters -##### params - -###### callbackContext - -`Context` - -The context for the current agent call. + + + + The context for the current agent call. + -###### llmResponse - -`LlmResponse` - -The response object received from the model. + + The response object received from the model. + + + #### Returns @@ -154,22 +150,22 @@ An optional value. A non-`undefined` return may be used by the > **afterRunCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed after an ADK runner run has completed. This is the final callback in the ADK lifecycle, suitable for cleanup, final logging, or reporting tasks. -Defined in: [src/integrations/googleAdk.ts:713](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L713) - #### Parameters -##### params - -###### invocationContext - -`InvocationContext` - -The context for the entire invocation. + + + + The context for the entire invocation. + + + #### Returns @@ -187,40 +183,34 @@ undefined > **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. -Defined in: [src/integrations/googleAdk.ts:965](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L965) - #### Parameters -##### params + + + + The dictionary returned by the tool invocation. + -###### result + + The tool instance that has just been executed. + -`Record`\<`string`, `unknown`\> \| `null` + + The original arguments that were passed to the tool. + -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. + + The context specific to the tool execution. + + + #### Returns @@ -241,28 +231,26 @@ An optional dictionary. If a dictionary is returned, it will > **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. -Defined in: [src/integrations/googleAdk.ts:765](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L765) - #### Parameters -##### params - -###### agent - -`BaseAgent` - -The agent that is about to run. + + + + The agent that is about to run. + -###### callbackContext - -`Context` - -The context for the agent invocation. + + The context for the agent invocation. + + + #### Returns @@ -282,18 +270,16 @@ An optional `Content` object. If a value is returned, it will > **beforeContextCompaction**(`_params`): `Promise`\<`undefined`\> + + Callback executed before context compaction. This callback provides an opportunity to inspect or modify the context before it is compacted. -Defined in: [src/integrations/googleAdk.ts:993](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L993) - #### Parameters -##### \_params - -`unknown` + #### Returns @@ -309,29 +295,27 @@ Defined in: [src/integrations/googleAdk.ts:993](https://github.com/wandb/weave/b > **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. -Defined in: [src/integrations/googleAdk.ts:804](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L804) - #### Parameters -##### params + + + + The context for the current agent call. + -###### callbackContext - -`Context` - -The context for the current agent call. - -###### llmRequest - -`LlmRequest` - -The prepared request object to be sent to the model. + + The prepared request object to be sent to the model. + + + #### Returns @@ -351,23 +335,23 @@ An optional value. The interpretation of a non-`undefined` > **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. -Defined in: [src/integrations/googleAdk.ts:621](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L621) - #### Parameters -##### params - -###### invocationContext - -`InvocationContext` - -The context for the entire invocation, containing - session information, the root agent, etc. + + + + The context for the entire invocation, containing + session information, the root agent, etc. + + + #### Returns @@ -387,35 +371,31 @@ An optional `Event` to be returned to the ADK. Returning a value > **beforeToolCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed before a tool is called. This callback is useful for logging tool usage, input validation, or modifying the arguments before they are passed to the tool. -Defined in: [src/integrations/googleAdk.ts:918](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L918) - #### Parameters -##### params - -###### tool + + + + The tool instance that is about to be executed. + -`BaseTool` + + The dictionary of arguments to be used for invoking the + tool. + -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. + + The context specific to the tool execution. + + + #### Returns @@ -435,18 +415,16 @@ An optional dictionary. If a dictionary is returned, it will stop > **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. -Defined in: [src/integrations/googleAdk.ts:914](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L914) - #### Parameters -##### \_params - -`unknown` + #### Returns @@ -466,6 +444,8 @@ An optional value. A non-`undefined` return may be used by the > **finishInterruptedInvocation**(`invocationId`): `void` + + Finalizes a run that never reached `afterRunCallback`. ADK only dispatches `afterRunCallback` after the event loop drains normally, so a consumer that breaks out of `runAsync` early — or an aborted run — leaves the invocation @@ -473,13 +453,9 @@ breaks out of `runAsync` early — or an aborted run — leaves the invocation `finally` to close them as interrupted. Idempotent: a no-op once the run has already finished (the common, fully-consumed case). -Defined in: [src/integrations/googleAdk.ts:732](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L732) - #### Parameters -##### invocationId - -`string` + #### Returns @@ -491,38 +467,34 @@ Defined in: [src/integrations/googleAdk.ts:732](https://github.com/wandb/weave/b > **onEventCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed after an event is yielded from runner. This is the ideal place to make modification to the event before the event is handled by the underlying agent app. -Defined in: [src/integrations/googleAdk.ts:693](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L693) - #### Parameters -##### params + + + + The event raised by the runner. + -###### event - -`Event` - -The event raised by the runner. - -###### invocationContext - -`InvocationContext` - -The context for the entire invocation. + + 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. Copy `params.event` when - constructing a replacement to preserve fields that are not being - modified, such as event actions. Returning `undefined` allows the - original response to be used. + framework to modify or replace the response. Returning `undefined` + allows the original response to be used. #### Implementation of @@ -534,35 +506,31 @@ An optional value. A non-`undefined` return may be used by the > **onModelErrorCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed when a model call encounters an error. This callback provides an opportunity to handle model errors gracefully, potentially providing alternative responses or recovery mechanisms. -Defined in: [src/integrations/googleAdk.ts:884](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L884) - #### Parameters -##### params - -###### callbackContext - -`Context` - -The context for the current agent call. - -###### error + + + + The context for the current agent call. + -`Error` + + The exception that was raised during model execution. + -The exception that was raised during model execution. - -###### llmRequest - -`LlmRequest` - -The request that was sent to the model when the error - occurred. + + The request that was sent to the model when the error + occurred. + + + #### Returns @@ -582,6 +550,8 @@ An optional LlmResponse. If an LlmResponse is returned, it will be > **onToolErrorCallback**(`params`): `Promise`\<`undefined`\> + + Callback executed when a tool call encounters an error. tool: BaseTool; toolArgs: Record\; @@ -597,35 +567,27 @@ 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. -Defined in: [src/integrations/googleAdk.ts:977](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L977) - #### Parameters -##### params - -###### error + + + + The exception that was raised during tool execution. + -`Error` + + The tool instance that encountered an error. + -The exception that was raised during tool execution. + + The arguments that were passed to the tool. + -###### 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. + + The context specific to the tool execution. + + + #### Returns @@ -645,25 +607,23 @@ An optional dictionary. If a dictionary is returned, it will be > **onUserMessageCallback**(`_params`): `Promise`\<`undefined`\> + + Callback executed when a user message is received before an invocation starts. This callback helps logging and modifying the user message before the runner starts the invocation. -Defined in: [src/integrations/googleAdk.ts:614](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleAdk.ts#L614) - #### Parameters -##### \_params - -###### invocationContext - -`InvocationContext` - -###### userMessage + + + -`Content` + + + #### Returns diff --git a/weave/reference/typescript-sdk/classes/weaveobject.mdx b/weave/reference/typescript-sdk/classes/weaveobject.mdx index 0ad2c5ac3e..d239471af9 100644 --- a/weave/reference/typescript-sdk/classes/weaveobject.mdx +++ b/weave/reference/typescript-sdk/classes/weaveobject.mdx @@ -3,7 +3,9 @@ title: "WeaveObject" description: "TypeScript SDK reference" --- -Defined in: [src/weaveObject.ts:70](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L70) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extended by @@ -16,13 +18,17 @@ Defined in: [src/weaveObject.ts:70](https://github.com/wandb/weave/blob/8c5f077e > **new WeaveObject**(`_baseParameters`): `WeaveObject` -Defined in: [src/weaveObject.ts:73](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L73) + #### Parameters -##### \_baseParameters + + + -`WeaveObjectParameters` + + + #### Returns @@ -34,7 +40,7 @@ Defined in: [src/weaveObject.ts:73](https://github.com/wandb/weave/blob/8c5f077e > `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) + ## Accessors @@ -44,7 +50,7 @@ Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077e > **get** **description**(): `string` \| `undefined` -Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98) + ##### Returns @@ -58,7 +64,7 @@ Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077e > **get** **name**(): `string` -Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94) + ##### Returns @@ -70,7 +76,7 @@ Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077e > **saveAttrs**(): `object` -Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75) + #### Returns diff --git a/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx b/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx index 7ef150cedc..b4bc9d26fd 100644 --- a/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx +++ b/weave/reference/typescript-sdk/functions/createopenaiagentstracingprocessor.mdx @@ -3,11 +3,15 @@ title: "createOpenAIAgentsTracingProcessor" description: "TypeScript SDK reference" --- -> **createOpenAIAgentsTracingProcessor**(): `TracingProcessor` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Create a new Weave tracing processor for OpenAI Agents. +```ts +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 diff --git a/weave/reference/typescript-sdk/functions/createotelextension.mdx b/weave/reference/typescript-sdk/functions/createotelextension.mdx index 923c416c35..58c02a2e5d 100644 --- a/weave/reference/typescript-sdk/functions/createotelextension.mdx +++ b/weave/reference/typescript-sdk/functions/createotelextension.mdx @@ -3,7 +3,13 @@ title: "createOtelExtension" description: "TypeScript SDK reference" --- -> **createOtelExtension**(`opts?`): (`pi`) => `void` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +createOtelExtension(opts?: object): (pi) => void +``` + + Creates a pi coding agent extension that emits OTEL spans for the full agent lifecycle, conforming to the GenAI semantic conventions. @@ -12,13 +18,15 @@ 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`. -Defined in: [src/integrations/piCodingAgent.ts:654](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/piCodingAgent.ts#L654) - ## Parameters -### opts? + + + -`OtelExtensionOptions` = `{}` + + + ## Returns diff --git a/weave/reference/typescript-sdk/functions/endconversation.mdx b/weave/reference/typescript-sdk/functions/endconversation.mdx index fa4d1be980..15e34084d7 100644 --- a/weave/reference/typescript-sdk/functions/endconversation.mdx +++ b/weave/reference/typescript-sdk/functions/endconversation.mdx @@ -3,17 +3,25 @@ title: "endConversation" description: "TypeScript SDK reference" --- -> **endConversation**(`opts?`): `void` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -End the current Conversation. No-op if no Conversation is active. +```ts +endConversation(opts?: object): 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 -### opts? + + + -`SpanEndOptions` + + + ## Returns diff --git a/weave/reference/typescript-sdk/functions/endllm.mdx b/weave/reference/typescript-sdk/functions/endllm.mdx index 8a7da69ecc..9c1a8c2a2e 100644 --- a/weave/reference/typescript-sdk/functions/endllm.mdx +++ b/weave/reference/typescript-sdk/functions/endllm.mdx @@ -3,17 +3,25 @@ title: "endLLM" description: "TypeScript SDK reference" --- -> **endLLM**(`opts?`): `void` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -End the current LLM. No-op if no LLM is active. +```ts +endLLM(opts?: object): 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 -### opts? + + + -`SpanEndOptions` + + + ## Returns diff --git a/weave/reference/typescript-sdk/functions/endturn.mdx b/weave/reference/typescript-sdk/functions/endturn.mdx index 14b67d7c60..c50798680d 100644 --- a/weave/reference/typescript-sdk/functions/endturn.mdx +++ b/weave/reference/typescript-sdk/functions/endturn.mdx @@ -3,17 +3,25 @@ title: "endTurn" description: "TypeScript SDK reference" --- -> **endTurn**(`opts?`): `void` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -End the current Turn. No-op if no Turn is active. +```ts +endTurn(opts?: object): 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 -### opts? + + + -`SpanEndOptions` + + + ## Returns diff --git a/weave/reference/typescript-sdk/functions/flush.mdx b/weave/reference/typescript-sdk/functions/flush.mdx new file mode 100644 index 0000000000..f091d4bef3 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/flush.mdx @@ -0,0 +1,18 @@ +--- +title: "flush" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +flush(): Promise +``` + + + +Deliver all buffered calls to the server. Await before `process.exit()`. + +## Returns + +`Promise`\<`void`\> \ 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 80983c4584..7bc8b33782 100644 --- a/weave/reference/typescript-sdk/functions/flushotel.mdx +++ b/weave/reference/typescript-sdk/functions/flushotel.mdx @@ -3,7 +3,13 @@ title: "flushOTel" description: "TypeScript SDK reference" --- -> **flushOTel**(): `Promise`\<`void`\> +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +flushOTel(): Promise +``` + + Force-flush any GenAI spans buffered by the active span processor. @@ -16,8 +22,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. -Defined in: [src/genai/flush.ts:15](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/flush.ts#L15) - ## Returns `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 8d8b3d3dcb..19e639cbad 100644 --- a/weave/reference/typescript-sdk/functions/getcurrentconversation.mdx +++ b/weave/reference/typescript-sdk/functions/getcurrentconversation.mdx @@ -3,11 +3,15 @@ title: "getCurrentConversation" description: "TypeScript SDK reference" --- -> **getCurrentConversation**(): [`Conversation`](../interfaces/conversation) \| `undefined` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Returns the current Conversation, or undefined. +```ts +getCurrentConversation(): 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 diff --git a/weave/reference/typescript-sdk/functions/getcurrentllm.mdx b/weave/reference/typescript-sdk/functions/getcurrentllm.mdx index a1cc84c732..25eb4a163f 100644 --- a/weave/reference/typescript-sdk/functions/getcurrentllm.mdx +++ b/weave/reference/typescript-sdk/functions/getcurrentllm.mdx @@ -3,11 +3,15 @@ title: "getCurrentLLM" description: "TypeScript SDK reference" --- -> **getCurrentLLM**(): [`LLM`](../interfaces/llm) \| `undefined` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Returns the current LLM, or undefined. +```ts +getCurrentLLM(): 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 diff --git a/weave/reference/typescript-sdk/functions/getcurrentturn.mdx b/weave/reference/typescript-sdk/functions/getcurrentturn.mdx index 712e1dae72..acc8da7421 100644 --- a/weave/reference/typescript-sdk/functions/getcurrentturn.mdx +++ b/weave/reference/typescript-sdk/functions/getcurrentturn.mdx @@ -3,11 +3,15 @@ title: "getCurrentTurn" description: "TypeScript SDK reference" --- -> **getCurrentTurn**(): [`Turn`](../interfaces/turn) \| `undefined` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Returns the current Turn, or undefined. +```ts +getCurrentTurn(): 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 diff --git a/weave/reference/typescript-sdk/functions/init.mdx b/weave/reference/typescript-sdk/functions/init.mdx index 89090b54a0..c2f09bdc5f 100644 --- a/weave/reference/typescript-sdk/functions/init.mdx +++ b/weave/reference/typescript-sdk/functions/init.mdx @@ -3,28 +3,30 @@ title: "init" description: "TypeScript SDK reference" --- -> **init**(`project`, `settings?`): `Promise`\<[`WeaveClient`](../interfaces/weaveclient)\> +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Initialize the Weave client, which is required for weave tracing to work. - -Defined in: [src/clientApi.ts:87](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L87) - -## Parameters +```ts +init(project: string, settings?: Partial<{…}>): Promise +``` -### project + -`string` +Initialize the Weave client, which is required for weave tracing to work. -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 +## Parameters -### settings? + + 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 + -`Partial`\<[`Settings`](../type-aliases/settings)\> + + (Optional) Weave tracing settings -(Optional) Weave tracing settings + Full type: `Partial<{ attributes: Record; genai: { batchOptions?: BufferConfig; spanProcessor?: "batch" | "simple" | SpanProcessor; }; printCallLink: boolean; useCallsComplete: boolean; useOTelV2: boolean; }>` + ## Returns diff --git a/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx b/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx index b37cbc458f..f069fe9c3c 100644 --- a/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx +++ b/weave/reference/typescript-sdk/functions/instrumentopenaiagents.mdx @@ -3,7 +3,13 @@ title: "instrumentOpenAIAgents" description: "TypeScript SDK reference" --- -> **instrumentOpenAIAgents**(): `Promise`\<`boolean`\> +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +instrumentOpenAIAgents(): Promise +``` + + Manually register Weave tracing with OpenAI Agents if the package is available. @@ -16,8 +22,6 @@ 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. -Defined in: [src/integrations/openai.agent.ts:169](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.agent.ts#L169) - ## Returns `Promise`\<`boolean`\> diff --git a/weave/reference/typescript-sdk/functions/login.mdx b/weave/reference/typescript-sdk/functions/login.mdx index 6149cd1bc3..f08e78effb 100644 --- a/weave/reference/typescript-sdk/functions/login.mdx +++ b/weave/reference/typescript-sdk/functions/login.mdx @@ -3,27 +3,27 @@ title: "login" description: "TypeScript SDK reference" --- -> **login**(`apiKey`, `host?`): `Promise`\<`void`\> +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +login(apiKey: string, host?: string): Promise +``` + + 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. -Defined in: [src/clientApi.ts:27](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L27) - ## Parameters -### apiKey - -`string` - -Your W&B API key. - -### host? - -`string` + + Your W&B API key. + -(Optional) The host name (usually only needed if you're using a custom W&B server). + + (Optional) The host name (usually only needed if you're using a custom W&B server). + ## Returns diff --git a/weave/reference/typescript-sdk/functions/op.mdx b/weave/reference/typescript-sdk/functions/op.mdx index bb9dab9be8..b32bec61d4 100644 --- a/weave/reference/typescript-sdk/functions/op.mdx +++ b/weave/reference/typescript-sdk/functions/op.mdx @@ -3,27 +3,71 @@ title: "op" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + ## Call Signature -> **op**\<`T`\>(`fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> +```ts +op(fn: T, options?: object): Op +``` -Defined in: [src/op.ts:380](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L380) + ### Type Parameters -#### T - -`T` *extends* (...`args`) => `any` + ### Parameters -#### fn + + + + + + Default attributes applied to every call this op creates. Integrations set + this to stamp `attributes.integration` provenance. Merged beneath `kind`/ + `color`, which take precedence on key collision. + + + + See [`WeaveObject`](../classes/weaveobject). + + + + + + + + + + Custom color for the operation in the UI + + + + The kind of operation (e.g., 'llm', 'agent', 'tool', 'search') for UI categorization + + + -`T` + -#### options? + -`OpOptions`\<`T`\> + + Full type: `{ finalizeFn: (state) => void; initialStateFn: () => any; reduceFn: (state, chunk) => any; }` + + + + + + + + + + + + + ### Returns @@ -31,29 +75,69 @@ Defined in: [src/op.ts:380](https://github.com/wandb/weave/blob/8c5f077eb11c42b8 ## Call Signature -> **op**\<`T`\>(`thisArg`, `fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> +```ts +op(thisArg: any, fn: T, options?: object): Op +``` -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 -#### thisArg + + + + + + + + Default attributes applied to every call this op creates. Integrations set + this to stamp `attributes.integration` provenance. Merged beneath `kind`/ + `color`, which take precedence on key collision. + + + + See [`WeaveObject`](../classes/weaveobject). + + + -`any` + -#### fn + -`T` + + Custom color for the operation in the UI + -#### options? + + The kind of operation (e.g., 'llm', 'agent', 'tool', 'search') for UI categorization + -`OpOptions`\<`T`\> + + + + + + + + Full type: `{ finalizeFn: (state) => void; initialStateFn: () => any; reduceFn: (state, chunk) => any; }` + + + + + + + + + + + + + ### Returns @@ -61,23 +145,19 @@ Defined in: [src/op.ts:385](https://github.com/wandb/weave/blob/8c5f077eb11c42b8 ## Call Signature -> **op**(`target`, `propertyKey`, `descriptor`): `TypedPropertyDescriptor`\<`any`\> +```ts +op(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor +``` -Defined in: [src/op.ts:391](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L391) + ### Parameters -#### target - -`object` + -#### propertyKey + -`string` \| `symbol` - -#### descriptor - -`TypedPropertyDescriptor`\<`any`\> + ### Returns @@ -85,25 +165,45 @@ Defined in: [src/op.ts:391](https://github.com/wandb/weave/blob/8c5f077eb11c42b8 ## Call Signature -> **op**\<`T`\>(`value`, `context`): [`Op`](../type-aliases/op)\<`T`\> +```ts +op(value: T, context: object): Op +``` -Defined in: [src/op.ts:397](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L397) + ### Type Parameters -#### T - -`T` *extends* (...`args`) => `any` + ### Parameters -#### value + + + + + + + + + + + + + -`T` + -#### context + -`MethodDecoratorContext` + + + + + + + + + ### Returns @@ -111,15 +211,15 @@ Defined in: [src/op.ts:397](https://github.com/wandb/weave/blob/8c5f077eb11c42b8 ## Call Signature -> **op**(`options`): `MethodDecorator` +```ts +op(options: Partial>): MethodDecorator +``` -Defined in: [src/op.ts:402](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/op.ts#L402) + ### Parameters -#### options - -`Partial`\<`OpOptions`\<`any`\>\> + ### Returns diff --git a/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx b/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx index 5d5aed33c2..28395b97b9 100644 --- a/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx +++ b/weave/reference/typescript-sdk/functions/patchrealtimesession.mdx @@ -3,7 +3,13 @@ title: "patchRealtimeSession" description: "TypeScript SDK reference" --- -> **patchRealtimeSession**(): `Promise`\<`boolean`\> +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +patchRealtimeSession(): Promise +``` + + Manually patch the `RealtimeSession` class from `@openai/agents-realtime` so that every new instance is automatically traced by Weave. @@ -16,8 +22,6 @@ 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. -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) - ## Returns `Promise`\<`boolean`\> diff --git a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx index 605747abce..372ac09712 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx @@ -3,10 +3,24 @@ title: "requireCurrentCallStackEntry" description: "TypeScript SDK reference" --- -> **requireCurrentCallStackEntry**(): `CallStackEntry` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Defined in: [src/clientApi.ts:163](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L163) +```ts +requireCurrentCallStackEntry(): object +``` + + ## Returns -`CallStackEntry` \ No newline at end of file +`object` + + + + + + + + + + diff --git a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx index 9b5243bbc2..a87463dd9a 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx @@ -3,9 +3,13 @@ title: "requireCurrentChildSummary" description: "TypeScript SDK reference" --- -> **requireCurrentChildSummary**(): `object` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Defined in: [src/clientApi.ts:175](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L175) +```ts +requireCurrentChildSummary(): object +``` + + ## Returns diff --git a/weave/reference/typescript-sdk/functions/runisolated.mdx b/weave/reference/typescript-sdk/functions/runisolated.mdx index d32f53ab65..27e2ba26cf 100644 --- a/weave/reference/typescript-sdk/functions/runisolated.mdx +++ b/weave/reference/typescript-sdk/functions/runisolated.mdx @@ -3,7 +3,13 @@ title: "runIsolated" description: "TypeScript SDK reference" --- -> **runIsolated**\<`T`\>(`fn`): `T` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +runIsolated(fn: () => T): T +``` + + 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 @@ -22,19 +28,13 @@ Use this to safely run parallel GenAI work: Sequential single-flight usage doesn't require this wrapper — the process-wide default state handles it. -Defined in: [src/genai/context.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L54) - ## Type Parameters -### T - -`T` + ## Parameters -### fn - -() => `T` + ## Returns diff --git a/weave/reference/typescript-sdk/functions/startconversation.mdx b/weave/reference/typescript-sdk/functions/startconversation.mdx index bf6f668f73..3901fdd2d9 100644 --- a/weave/reference/typescript-sdk/functions/startconversation.mdx +++ b/weave/reference/typescript-sdk/functions/startconversation.mdx @@ -3,21 +3,25 @@ title: "startConversation" description: "TypeScript SDK reference" --- -> **startConversation**(`opts?`): [`Conversation`](../interfaces/conversation) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +startConversation(opts?: ConversationInit = {}): Conversation +``` + + 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 +Pass `attributes` to propagate custom (non-semconv) attributes to every span the conversation emits. -Defined in: [src/genai/api.ts:26](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L26) - ## Parameters -### opts? - -[`ConversationInit`](../interfaces/conversationinit) = `{}` + + See [`ConversationInit`](../interfaces/conversationinit). + ## Returns diff --git a/weave/reference/typescript-sdk/functions/startllm.mdx b/weave/reference/typescript-sdk/functions/startllm.mdx index ae09710fe8..8177f10202 100644 --- a/weave/reference/typescript-sdk/functions/startllm.mdx +++ b/weave/reference/typescript-sdk/functions/startllm.mdx @@ -3,18 +3,22 @@ title: "startLLM" description: "TypeScript SDK reference" --- -> **startLLM**(`opts`): [`LLM`](../interfaces/llm) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +startLLM(opts: LLMInit): LLM +``` + + Start an LLM span as a child of the current Turn. Throws if no Turn is active. -Defined in: [src/genai/api.ts:77](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L77) - ## Parameters -### opts - -[`LLMInit`](../interfaces/llminit) + + See [`LLMInit`](../interfaces/llminit). + ## Returns diff --git a/weave/reference/typescript-sdk/functions/startsubagent.mdx b/weave/reference/typescript-sdk/functions/startsubagent.mdx index e15f80cc79..898cc2e408 100644 --- a/weave/reference/typescript-sdk/functions/startsubagent.mdx +++ b/weave/reference/typescript-sdk/functions/startsubagent.mdx @@ -3,17 +3,21 @@ title: "startSubagent" description: "TypeScript SDK reference" --- -> **startSubagent**(`opts`): [`SubAgent`](../interfaces/subagent) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Start a SubAgent span. Same parent-resolution rules as `startTool`. +```ts +startSubagent(opts: SubAgentInit): SubAgent +``` -Defined in: [src/genai/api.ts:137](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L137) + -## Parameters +Start a SubAgent span. Same parent-resolution rules as `startTool`. -### opts +## Parameters -[`SubAgentInit`](../interfaces/subagentinit) + + See [`SubAgentInit`](../interfaces/subagentinit). + ## Returns diff --git a/weave/reference/typescript-sdk/functions/starttool.mdx b/weave/reference/typescript-sdk/functions/starttool.mdx index 9f198f8ea8..6f2b7c7d42 100644 --- a/weave/reference/typescript-sdk/functions/starttool.mdx +++ b/weave/reference/typescript-sdk/functions/starttool.mdx @@ -3,7 +3,13 @@ title: "startTool" description: "TypeScript SDK reference" --- -> **startTool**(`opts`): [`Tool`](../interfaces/tool) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +startTool(opts: ToolInit): Tool +``` + + Start a Tool span. Parent resolution (matches the design's "flat by default, hierarchical if you nest"): @@ -12,13 +18,11 @@ default, hierarchical if you nest"): Throws if neither a Turn nor an LLM is active. -Defined in: [src/genai/api.ts:110](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L110) - ## Parameters -### opts - -[`ToolInit`](../interfaces/toolinit) + + See [`ToolInit`](../interfaces/toolinit). + ## Returns @@ -30,7 +34,7 @@ Defined in: [src/genai/api.ts:110](https://github.com/wandb/weave/blob/8c5f077eb // @noErrors weave.startTool({ name: 'get_weather', - args: JSON.stringify({city: 'Tokyo'}), + args: {city: 'Tokyo'}, toolCallId: 'call_t1', }); ``` @@ -39,7 +43,7 @@ weave.startTool({ // @noErrors weave.startTool({ name: 'get_weather', - args: JSON.stringify({city: 'Tokyo'}), + args: {city: 'Tokyo'}, toolCallId: 'call_t1', startTime: new Date('2026-05-29T10:00:00.800Z'), }); diff --git a/weave/reference/typescript-sdk/functions/startturn.mdx b/weave/reference/typescript-sdk/functions/startturn.mdx index 0bb8877ba0..4b8e1593e8 100644 --- a/weave/reference/typescript-sdk/functions/startturn.mdx +++ b/weave/reference/typescript-sdk/functions/startturn.mdx @@ -3,18 +3,22 @@ title: "startTurn" description: "TypeScript SDK reference" --- -> **startTurn**(`opts?`): [`Turn`](../interfaces/turn) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +startTurn(opts?: TurnInit = {}): Turn +``` + + Start a new Turn. If a Conversation is active, the turn inherits its `conversationId`; otherwise the turn has no conversation id. -Defined in: [src/genai/api.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L54) - ## Parameters -### opts? - -[`TurnInit`](../interfaces/turninit) = `{}` + + See [`TurnInit`](../interfaces/turninit). + ## Returns diff --git a/weave/reference/typescript-sdk/functions/weaveaudio.mdx b/weave/reference/typescript-sdk/functions/weaveaudio.mdx index b6a1a7ad14..45a9e0220d 100644 --- a/weave/reference/typescript-sdk/functions/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/functions/weaveaudio.mdx @@ -3,21 +3,29 @@ title: "weaveAudio" description: "TypeScript SDK reference" --- -> **weaveAudio**(`options`): [`WeaveAudio`](../interfaces/weaveaudio) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Create a new WeaveAudio object +```ts +weaveAudio(options: object): 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 -### options + + 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 -`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 diff --git a/weave/reference/typescript-sdk/functions/weaveimage.mdx b/weave/reference/typescript-sdk/functions/weaveimage.mdx index 54d10eab2b..1d8082407e 100644 --- a/weave/reference/typescript-sdk/functions/weaveimage.mdx +++ b/weave/reference/typescript-sdk/functions/weaveimage.mdx @@ -3,21 +3,30 @@ title: "weaveImage" description: "TypeScript SDK reference" --- -> **weaveImage**(`options`): [`WeaveImage`](../interfaces/weaveimage) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Create a new WeaveImage object +```ts +weaveImage(options: object): 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 -### options + + The options for this media type + - data: The raw image data as a Buffer + - imageType: (Optional) The image format: 'png' (default), 'jpeg' or 'webp'. + Publishing always names the stored file image.png -`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 diff --git a/weave/reference/typescript-sdk/functions/withattributes.mdx b/weave/reference/typescript-sdk/functions/withattributes.mdx index 403992ab32..6dbae8c5bb 100644 --- a/weave/reference/typescript-sdk/functions/withattributes.mdx +++ b/weave/reference/typescript-sdk/functions/withattributes.mdx @@ -3,7 +3,13 @@ title: "withAttributes" description: "TypeScript SDK reference" --- -> **withAttributes**\<`T`\>(`attrs`, `fn`): `T` \| `Promise`\<`T`\> +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +withAttributes(attrs: Record, fn: () => T | Promise): T | Promise +``` + + Attach attributes to the current execution context so that any calls created inside `fn` automatically inherit them. Attributes are written to the call @@ -18,23 +24,15 @@ await withAttributes({requestId: 'abc'}, async () => { }); ``` -Defined in: [src/clientApi.ts:209](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/clientApi.ts#L209) - ## Type Parameters -### T - -`T` + ## Parameters -### attrs - -`Record`\<`string`, `any`\> - -### fn + -() => `T` \| `Promise`\<`T`\> + ## Returns diff --git a/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx b/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx index 1ff12057b4..c78b50b129 100644 --- a/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx +++ b/weave/reference/typescript-sdk/functions/wrapclaudeagentsdk.mdx @@ -3,7 +3,13 @@ title: "wrapClaudeAgentSdk" description: "TypeScript SDK reference" --- -> **wrapClaudeAgentSdk**\<`T`\>(`sdk`): `T` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +```ts +wrapClaudeAgentSdk(sdk: T): T +``` + + Manually instrument the `@anthropic-ai/claude-agent-sdk` module. @@ -14,19 +20,13 @@ 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): -Defined in: [src/integrations/claudeAgentSdk.ts:209](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/claudeAgentSdk.ts#L209) - ## Type Parameters -### T - -`T` + ## Parameters -### sdk - -`T` + ## Returns diff --git a/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx b/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx index d1c276417e..a33cccb9a4 100644 --- a/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapgooglegenai.mdx @@ -3,21 +3,21 @@ title: "wrapGoogleGenAI" description: "TypeScript SDK reference" --- -> **wrapGoogleGenAI**\<`T`\>(`googleGenAI`): `T` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Defined in: [src/integrations/googleGenAI.ts:239](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/googleGenAI.ts#L239) +```ts +wrapGoogleGenAI(googleGenAI: T): T +``` -## Type Parameters + -### T +## Type Parameters -`T` *extends* `GoogleGenAIAPI` + ## Parameters -### googleGenAI - -`T` + ## Returns diff --git a/weave/reference/typescript-sdk/functions/wrapopenai.mdx b/weave/reference/typescript-sdk/functions/wrapopenai.mdx index 1311ce40ea..592c7d19d3 100644 --- a/weave/reference/typescript-sdk/functions/wrapopenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapopenai.mdx @@ -3,23 +3,23 @@ title: "wrapOpenAI" description: "TypeScript SDK reference" --- -> **wrapOpenAI**\<`T`\>(`openai`): `T` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Wraps the OpenAI API to enable function tracing for OpenAI calls. +```ts +wrapOpenAI(openai: T): T +``` -Defined in: [src/integrations/openai.ts:723](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.ts#L723) + -## Type Parameters +Wraps the OpenAI API to enable function tracing for OpenAI calls. -### T +## Type Parameters -`T` *extends* `OpenAIAPI` + ## Parameters -### openai - -`T` + ## Returns diff --git a/weave/reference/typescript-sdk/interfaces/callschema.mdx b/weave/reference/typescript-sdk/interfaces/callschema.mdx index 6618802ea2..686eda6a16 100644 --- a/weave/reference/typescript-sdk/interfaces/callschema.mdx +++ b/weave/reference/typescript-sdk/interfaces/callschema.mdx @@ -3,9 +3,11 @@ title: "CallSchema" description: "TypeScript SDK reference" --- -CallSchema +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/generated/traceServerApi.ts:1847](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1847) +CallSchema ## Properties @@ -13,9 +15,9 @@ Defined in: [src/generated/traceServerApi.ts:1847](https://github.com/wandb/weav > **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) +Attributes *** @@ -23,9 +25,9 @@ Defined in: [src/generated/traceServerApi.ts:1870](https://github.com/wandb/weav > `optional` **deleted\_at**: `string` \| `null` -Deleted At + -Defined in: [src/generated/traceServerApi.ts:1891](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1891) +Deleted At *** @@ -33,9 +35,9 @@ Defined in: [src/generated/traceServerApi.ts:1891](https://github.com/wandb/weav > `optional` **display\_name**: `string` \| `null` -Display Name + -Defined in: [src/generated/traceServerApi.ts:1855](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1855) +Display Name *** @@ -43,9 +45,9 @@ Defined in: [src/generated/traceServerApi.ts:1855](https://github.com/wandb/weav > `optional` **ended\_at**: `string` \| `null` -Ended At + -Defined in: [src/generated/traceServerApi.ts:1874](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1874) +Ended At *** @@ -53,9 +55,9 @@ Defined in: [src/generated/traceServerApi.ts:1874](https://github.com/wandb/weav > `optional` **exception**: `string` \| `null` -Exception + -Defined in: [src/generated/traceServerApi.ts:1876](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1876) +Exception *** @@ -63,20 +65,20 @@ Defined in: [src/generated/traceServerApi.ts:1876](https://github.com/wandb/weav > `optional` **expire\_at**: `string` \| `null` + + 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 + -Defined in: [src/generated/traceServerApi.ts:1849](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1849) +Id *** @@ -84,9 +86,9 @@ Defined in: [src/generated/traceServerApi.ts:1849](https://github.com/wandb/weav > **inputs**: `Record`\<`string`, `any`\> -Inputs + -Defined in: [src/generated/traceServerApi.ts:1872](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1872) +Inputs *** @@ -94,9 +96,9 @@ Defined in: [src/generated/traceServerApi.ts:1872](https://github.com/wandb/weav > **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) +Op Name *** @@ -104,9 +106,9 @@ Defined in: [src/generated/traceServerApi.ts:1853](https://github.com/wandb/weav > `optional` **output**: `null` -Output + -Defined in: [src/generated/traceServerApi.ts:1878](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1878) +Output *** @@ -114,9 +116,9 @@ Defined in: [src/generated/traceServerApi.ts:1878](https://github.com/wandb/weav > `optional` **parent\_id**: `string` \| `null` -Parent Id + -Defined in: [src/generated/traceServerApi.ts:1859](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1859) +Parent Id *** @@ -124,9 +126,9 @@ Defined in: [src/generated/traceServerApi.ts:1859](https://github.com/wandb/weav > **project\_id**: `string` -Project Id + -Defined in: [src/generated/traceServerApi.ts:1851](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1851) +Project Id *** @@ -134,9 +136,9 @@ Defined in: [src/generated/traceServerApi.ts:1851](https://github.com/wandb/weav > **started\_at**: `string` -Started At + -Defined in: [src/generated/traceServerApi.ts:1868](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1868) +Started At #### Format @@ -148,9 +150,9 @@ date-time > `optional` **storage\_size\_bytes**: `number` \| `null` -Storage Size Bytes + -Defined in: [src/generated/traceServerApi.ts:1898](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1898) +Storage Size Bytes *** @@ -158,7 +160,7 @@ Defined in: [src/generated/traceServerApi.ts:1898](https://github.com/wandb/weav > `optional` **summary**: `Record`\<`string`, `any`\> -Defined in: [src/generated/traceServerApi.ts:1879](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1879) + *** @@ -166,9 +168,9 @@ Defined in: [src/generated/traceServerApi.ts:1879](https://github.com/wandb/weav > `optional` **thread\_id**: `string` \| `null` -Thread Id + -Defined in: [src/generated/traceServerApi.ts:1861](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1861) +Thread Id *** @@ -176,9 +178,9 @@ Defined in: [src/generated/traceServerApi.ts:1861](https://github.com/wandb/weav > `optional` **total\_storage\_size\_bytes**: `number` \| `null` -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) +Total Storage Size Bytes *** @@ -186,9 +188,9 @@ Defined in: [src/generated/traceServerApi.ts:1900](https://github.com/wandb/weav > **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) +Trace Id *** @@ -196,9 +198,9 @@ Defined in: [src/generated/traceServerApi.ts:1857](https://github.com/wandb/weav > `optional` **turn\_id**: `string` \| `null` -Turn Id + -Defined in: [src/generated/traceServerApi.ts:1863](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1863) +Turn Id *** @@ -206,9 +208,9 @@ Defined in: [src/generated/traceServerApi.ts:1863](https://github.com/wandb/weav > `optional` **wb\_run\_id**: `string` \| `null` -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 Id *** @@ -216,9 +218,9 @@ Defined in: [src/generated/traceServerApi.ts:1885](https://github.com/wandb/weav > `optional` **wb\_run\_step**: `number` \| `null` -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 *** @@ -226,9 +228,9 @@ Defined in: [src/generated/traceServerApi.ts:1887](https://github.com/wandb/weav > `optional` **wb\_run\_step\_end**: `number` \| `null` -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 Run Step End *** @@ -236,9 +238,9 @@ Defined in: [src/generated/traceServerApi.ts:1889](https://github.com/wandb/weav > `optional` **wb\_user\_id**: `string` \| `null` -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 User Id *** @@ -246,6 +248,6 @@ Defined in: [src/generated/traceServerApi.ts:1881](https://github.com/wandb/weav > `optional` **wb\_username**: `string` \| `null` -Wb Username + -Defined in: [src/generated/traceServerApi.ts:1883](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L1883) +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 45aaa218cf..245ac7f8a0 100644 --- a/weave/reference/typescript-sdk/interfaces/callsfilter.mdx +++ b/weave/reference/typescript-sdk/interfaces/callsfilter.mdx @@ -3,9 +3,11 @@ title: "CallsFilter" description: "TypeScript SDK reference" --- -CallsFilter +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/generated/traceServerApi.ts:2040](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2040) +CallsFilter ## Properties @@ -13,9 +15,9 @@ Defined in: [src/generated/traceServerApi.ts:2040](https://github.com/wandb/weav > `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) +Call Ids *** @@ -23,9 +25,9 @@ Defined in: [src/generated/traceServerApi.ts:2052](https://github.com/wandb/weav > `optional` **input\_refs**: `string`[] \| `null` -Input Refs + -Defined in: [src/generated/traceServerApi.ts:2044](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2044) +Input Refs *** @@ -33,9 +35,9 @@ Defined in: [src/generated/traceServerApi.ts:2044](https://github.com/wandb/weav > `optional` **op\_names**: `string`[] \| `null` -Op Names + -Defined in: [src/generated/traceServerApi.ts:2042](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2042) +Op Names *** @@ -43,9 +45,9 @@ Defined in: [src/generated/traceServerApi.ts:2042](https://github.com/wandb/weav > `optional` **output\_refs**: `string`[] \| `null` -Output Refs + -Defined in: [src/generated/traceServerApi.ts:2046](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2046) +Output Refs *** @@ -53,9 +55,9 @@ Defined in: [src/generated/traceServerApi.ts:2046](https://github.com/wandb/weav > `optional` **parent\_ids**: `string`[] \| `null` -Parent Ids + -Defined in: [src/generated/traceServerApi.ts:2048](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2048) +Parent Ids *** @@ -63,9 +65,9 @@ Defined in: [src/generated/traceServerApi.ts:2048](https://github.com/wandb/weav > `optional` **thread\_ids**: `string`[] \| `null` -Thread Ids + -Defined in: [src/generated/traceServerApi.ts:2054](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2054) +Thread Ids *** @@ -73,9 +75,9 @@ Defined in: [src/generated/traceServerApi.ts:2054](https://github.com/wandb/weav > `optional` **trace\_ids**: `string`[] \| `null` -Trace Ids + -Defined in: [src/generated/traceServerApi.ts:2050](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2050) +Trace Ids *** @@ -83,9 +85,9 @@ Defined in: [src/generated/traceServerApi.ts:2050](https://github.com/wandb/weav > `optional` **trace\_roots\_only**: `boolean` \| `null` -Trace Roots Only + -Defined in: [src/generated/traceServerApi.ts:2058](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2058) +Trace Roots Only *** @@ -93,9 +95,9 @@ Defined in: [src/generated/traceServerApi.ts:2058](https://github.com/wandb/weav > `optional` **turn\_ids**: `string`[] \| `null` -Turn Ids + -Defined in: [src/generated/traceServerApi.ts:2056](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2056) +Turn Ids *** @@ -103,9 +105,9 @@ Defined in: [src/generated/traceServerApi.ts:2056](https://github.com/wandb/weav > `optional` **wb\_run\_ids**: `string`[] \| `null` -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 Run Ids *** @@ -113,6 +115,6 @@ Defined in: [src/generated/traceServerApi.ts:2062](https://github.com/wandb/weav > `optional` **wb\_user\_ids**: `string`[] \| `null` -Wb User Ids + -Defined in: [src/generated/traceServerApi.ts:2060](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L2060) +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 index e3b8cc43b0..d0b525459e 100644 --- a/weave/reference/typescript-sdk/interfaces/conversation.mdx +++ b/weave/reference/typescript-sdk/interfaces/conversation.mdx @@ -3,11 +3,13 @@ title: "Conversation" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + 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. -Defined in: [src/genai/conversation.ts:72](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L72) - ## Accessors ### agentName @@ -16,7 +18,7 @@ Defined in: [src/genai/conversation.ts:72](https://github.com/wandb/weave/blob/8 > **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 @@ -30,7 +32,7 @@ Defined in: [src/genai/conversation.ts:94](https://github.com/wandb/weave/blob/8 > **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 @@ -44,7 +46,7 @@ Defined in: [src/genai/conversation.ts:106](https://github.com/wandb/weave/blob/ > **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 @@ -58,7 +60,7 @@ Defined in: [src/genai/conversation.ts:102](https://github.com/wandb/weave/blob/ > **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 @@ -76,7 +78,7 @@ Defined in: [src/genai/conversation.ts:98](https://github.com/wandb/weave/blob/8 > **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 @@ -88,13 +90,17 @@ Defined in: [src/genai/conversation.ts:111](https://github.com/wandb/weave/blob/ > **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 @@ -106,18 +112,18 @@ Defined in: [src/genai/conversation.ts:168](https://github.com/wandb/weave/blob/ > **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`. -Defined in: [src/genai/conversation.ts:156](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L156) - #### Parameters -##### opts? - -[`TurnInit`](./turninit) = `{}` + + See [`TurnInit`](./turninit). + #### Returns diff --git a/weave/reference/typescript-sdk/interfaces/conversationinit.mdx b/weave/reference/typescript-sdk/interfaces/conversationinit.mdx index 51d6e48093..792c1a21e7 100644 --- a/weave/reference/typescript-sdk/interfaces/conversationinit.mdx +++ b/weave/reference/typescript-sdk/interfaces/conversationinit.mdx @@ -3,7 +3,9 @@ title: "ConversationInit" description: "TypeScript SDK reference" --- -Defined in: [src/genai/conversation.ts:8](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L8) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Properties @@ -11,80 +13,80 @@ Defined in: [src/genai/conversation.ts:8](https://github.com/wandb/weave/blob/8c > `optional` **agentDescription**: `string` + + 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` + + 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 > `optional` **agentName**: `string` + + 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 > `optional` **agentVersion**: `string` + + 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` -Custom attributes stamped on every span the conversation emits. + + +Custom attributes propagated to 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 > `optional` **conversationId**: `string` + + 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 > `optional` **model**: `string` -Defined in: [src/genai/conversation.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/conversation.ts#L9) + *** @@ -96,4 +98,4 @@ Defined in: [src/genai/conversation.ts:9](https://github.com/wandb/weave/blob/8c > `optional` **sessionId**: `string` -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 + \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/customruntimeid.mdx b/weave/reference/typescript-sdk/interfaces/customruntimeid.mdx new file mode 100644 index 0000000000..4a89959385 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/customruntimeid.mdx @@ -0,0 +1,24 @@ +--- +title: "CustomRuntimeId" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + +## Properties + +### id + +> **id**: `string` + + + +*** + +### maxTokens + +> `optional` **maxTokens**: `number` + + \ 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 453065b60b..ce293d536e 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentsoptions.mdx @@ -3,9 +3,11 @@ title: "GetAgentsOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgents](./weaveclient#getagents). +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/weaveClient.ts:115](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L115) +Options for [WeaveClient.getAgents](./weaveclient#getagents). ## Properties @@ -13,7 +15,7 @@ Defined in: [src/weaveClient.ts:115](https://github.com/wandb/weave/blob/8c5f077 > `optional` **agentName**: `string` -Defined in: [src/weaveClient.ts:116](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L116) + *** @@ -21,7 +23,7 @@ Defined in: [src/weaveClient.ts:116](https://github.com/wandb/weave/blob/8c5f077 > `optional` **limit**: `number` -Defined in: [src/weaveClient.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L117) + *** @@ -29,7 +31,7 @@ Defined in: [src/weaveClient.ts:117](https://github.com/wandb/weave/blob/8c5f077 > `optional` **offset**: `number` -Defined in: [src/weaveClient.ts:118](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L118) + *** @@ -37,4 +39,4 @@ Defined in: [src/weaveClient.ts:118](https://github.com/wandb/weave/blob/8c5f077 > `optional` **sortBy**: [`SortBy`](./sortby)[] -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 4b3830df36..49a6ebdff3 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentspansoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentspansoptions.mdx @@ -3,9 +3,11 @@ title: "GetAgentSpansOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentSpans](./weaveclient#getagentspans). +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/weaveClient.ts:160](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L160) +Options for [WeaveClient.getAgentSpans](./weaveclient#getagentspans). ## Properties @@ -13,7 +15,7 @@ Defined in: [src/weaveClient.ts:160](https://github.com/wandb/weave/blob/8c5f077 > `optional` **agentName**: `string` -Defined in: [src/weaveClient.ts:161](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L161) + *** @@ -21,7 +23,7 @@ Defined in: [src/weaveClient.ts:161](https://github.com/wandb/weave/blob/8c5f077 > `optional` **limit**: `number` -Defined in: [src/weaveClient.ts:171](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L171) + #### Min @@ -44,7 +46,7 @@ Defined in: [src/weaveClient.ts:171](https://github.com/wandb/weave/blob/8c5f077 > `optional` **offset**: `number` -Defined in: [src/weaveClient.ts:176](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L176) + #### Min @@ -63,9 +65,9 @@ Defined in: [src/weaveClient.ts:176](https://github.com/wandb/weave/blob/8c5f077 > `optional` **query**: [`Query`](./query) \| `null` -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) +Mongo-style filter on the spans. *** @@ -73,4 +75,4 @@ Defined in: [src/weaveClient.ts:165](https://github.com/wandb/weave/blob/8c5f077 > `optional` **sortBy**: [`SortBy`](./sortby)[] -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 d638b60d1f..5303f35e6f 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentturnoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentturnoptions.mdx @@ -3,9 +3,11 @@ title: "GetAgentTurnOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentTurn](./weaveclient#getagentturn). +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/weaveClient.ts:220](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L220) +Options for [WeaveClient.getAgentTurn](./weaveclient#getagentturn). ## Properties @@ -13,7 +15,7 @@ Defined in: [src/weaveClient.ts:220](https://github.com/wandb/weave/blob/8c5f077 > `optional` **includeFeedback**: `boolean` -Defined in: [src/weaveClient.ts:222](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L222) + *** @@ -21,4 +23,4 @@ Defined in: [src/weaveClient.ts:222](https://github.com/wandb/weave/blob/8c5f077 > **traceId**: `string` -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 9c753a2c6c..9b86d1f779 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentturnsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentturnsoptions.mdx @@ -3,9 +3,11 @@ title: "GetAgentTurnsOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentTurns](./weaveclient#getagentturns). +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/weaveClient.ts:233](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L233) +Options for [WeaveClient.getAgentTurns](./weaveclient#getagentturns). ## Properties @@ -13,7 +15,7 @@ Defined in: [src/weaveClient.ts:233](https://github.com/wandb/weave/blob/8c5f077 > **conversationId**: `string` -Defined in: [src/weaveClient.ts:234](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L234) + *** @@ -21,7 +23,7 @@ Defined in: [src/weaveClient.ts:234](https://github.com/wandb/weave/blob/8c5f077 > `optional` **includeFeedback**: `boolean` -Defined in: [src/weaveClient.ts:246](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L246) + *** @@ -29,7 +31,7 @@ Defined in: [src/weaveClient.ts:246](https://github.com/wandb/weave/blob/8c5f077 > `optional` **limit**: `number` -Defined in: [src/weaveClient.ts:240](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L240) + #### Min @@ -52,7 +54,7 @@ Defined in: [src/weaveClient.ts:240](https://github.com/wandb/weave/blob/8c5f077 > `optional` **offset**: `number` -Defined in: [src/weaveClient.ts:245](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L245) + #### Min diff --git a/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx b/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx index 97328a34ff..a8e496ce97 100644 --- a/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getagentversionsoptions.mdx @@ -3,9 +3,11 @@ title: "GetAgentVersionsOptions" description: "TypeScript SDK reference" --- -Options for [WeaveClient.getAgentVersions](./weaveclient#getagentversions). +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/weaveClient.ts:133](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L133) +Options for [WeaveClient.getAgentVersions](./weaveclient#getagentversions). ## Properties @@ -13,7 +15,7 @@ Defined in: [src/weaveClient.ts:133](https://github.com/wandb/weave/blob/8c5f077 > **agentName**: `string` -Defined in: [src/weaveClient.ts:134](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L134) + *** @@ -21,7 +23,7 @@ Defined in: [src/weaveClient.ts:134](https://github.com/wandb/weave/blob/8c5f077 > `optional` **limit**: `number` -Defined in: [src/weaveClient.ts:140](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L140) + #### Min @@ -44,7 +46,7 @@ Defined in: [src/weaveClient.ts:140](https://github.com/wandb/weave/blob/8c5f077 > `optional` **offset**: `number` -Defined in: [src/weaveClient.ts:145](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L145) + #### Min @@ -63,4 +65,4 @@ Defined in: [src/weaveClient.ts:145](https://github.com/wandb/weave/blob/8c5f077 > `optional` **sortBy**: [`SortBy`](./sortby)[] -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 3735c1e7da..b30ddda98d 100644 --- a/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx +++ b/weave/reference/typescript-sdk/interfaces/getcallsoptions.mdx @@ -3,7 +3,9 @@ title: "GetCallsOptions" description: "TypeScript SDK reference" --- -Defined in: [src/weaveClient.ts:93](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L93) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Properties @@ -11,7 +13,7 @@ Defined in: [src/weaveClient.ts:93](https://github.com/wandb/weave/blob/8c5f077e > `optional` **columns**: `string`[] -Defined in: [src/weaveClient.ts:101](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L101) + *** @@ -19,7 +21,7 @@ Defined in: [src/weaveClient.ts:101](https://github.com/wandb/weave/blob/8c5f077 > `optional` **expandColumns**: `string`[] -Defined in: [src/weaveClient.ts:102](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L102) + *** @@ -27,7 +29,7 @@ Defined in: [src/weaveClient.ts:102](https://github.com/wandb/weave/blob/8c5f077 > `optional` **filter**: [`CallsFilter`](./callsfilter) -Defined in: [src/weaveClient.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L94) + *** @@ -35,7 +37,7 @@ Defined in: [src/weaveClient.ts:94](https://github.com/wandb/weave/blob/8c5f077e > `optional` **includeCosts**: `boolean` -Defined in: [src/weaveClient.ts:96](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L96) + *** @@ -43,7 +45,7 @@ Defined in: [src/weaveClient.ts:96](https://github.com/wandb/weave/blob/8c5f077e > `optional` **includeFeedback**: `boolean` -Defined in: [src/weaveClient.ts:97](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L97) + *** @@ -51,7 +53,7 @@ Defined in: [src/weaveClient.ts:97](https://github.com/wandb/weave/blob/8c5f077e > `optional` **limit**: `number` -Defined in: [src/weaveClient.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L98) + *** @@ -59,7 +61,7 @@ Defined in: [src/weaveClient.ts:98](https://github.com/wandb/weave/blob/8c5f077e > `optional` **offset**: `number` -Defined in: [src/weaveClient.ts:99](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L99) + *** @@ -67,7 +69,7 @@ Defined in: [src/weaveClient.ts:99](https://github.com/wandb/weave/blob/8c5f077e > `optional` **query**: [`Query`](./query) -Defined in: [src/weaveClient.ts:95](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L95) + *** @@ -75,4 +77,4 @@ Defined in: [src/weaveClient.ts:95](https://github.com/wandb/weave/blob/8c5f077e > `optional` **sortBy**: [`SortBy`](./sortby)[] -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 b17e2f853b..35fbac0dca 100644 --- a/weave/reference/typescript-sdk/interfaces/httpresponse.mdx +++ b/weave/reference/typescript-sdk/interfaces/httpresponse.mdx @@ -3,7 +3,9 @@ title: "HttpResponse" description: "TypeScript SDK reference" --- -Defined in: [src/generated/traceServerApi.ts:5989](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5989) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -11,13 +13,9 @@ Defined in: [src/generated/traceServerApi.ts:5989](https://github.com/wandb/weav ## Type Parameters -### D - -`D` *extends* `unknown` - -### E + -`E` *extends* `unknown` = `unknown` + ## Properties @@ -25,7 +23,7 @@ Defined in: [src/generated/traceServerApi.ts:5989](https://github.com/wandb/weav > `readonly` **body**: `ReadableStream`\<`Uint8Array`\<`ArrayBuffer`\>\> \| `null` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4468 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4468 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) @@ -39,7 +37,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4468 > `readonly` **bodyUsed**: `boolean` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4470 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4470 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) @@ -53,7 +51,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4470 > **data**: `D` -Defined in: [src/generated/traceServerApi.ts:5991](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5991) + *** @@ -61,7 +59,7 @@ Defined in: [src/generated/traceServerApi.ts:5991](https://github.com/wandb/weav > **error**: `E` -Defined in: [src/generated/traceServerApi.ts:5992](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5992) + *** @@ -69,7 +67,7 @@ Defined in: [src/generated/traceServerApi.ts:5992](https://github.com/wandb/weav > `readonly` **headers**: `Headers` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26322 +Source: node\_modules/typescript/lib/lib.dom.d.ts:26322 The `headers` read-only property of the with the response. @@ -85,7 +83,7 @@ The `headers` read-only property of the with the response. > `readonly` **ok**: `boolean` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26328 +Source: 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. @@ -101,7 +99,7 @@ The `ok` read-only property of the Response interface contains a Boolean stating > `readonly` **redirected**: `boolean` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26334 +Source: 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. @@ -117,7 +115,7 @@ The `redirected` read-only property of the Response interface indicates whether > `readonly` **status**: `number` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26340 +Source: 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. @@ -133,7 +131,7 @@ The `status` read-only property of the Response interface contains the HTTP stat > `readonly` **statusText**: `string` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26346 +Source: 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. @@ -149,7 +147,7 @@ The `statusText` read-only property of the Response interface contains the statu > `readonly` **type**: `ResponseType` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26352 +Source: node\_modules/typescript/lib/lib.dom.d.ts:26352 The `type` read-only property of the Response interface contains the type of the response. @@ -165,7 +163,7 @@ The `type` read-only property of the Response interface contains the type of the > `readonly` **url**: `string` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26358 +Source: node\_modules/typescript/lib/lib.dom.d.ts:26358 The `url` read-only property of the Response interface contains the URL of the response. @@ -181,7 +179,7 @@ The `url` read-only property of the Response interface contains the URL of the r > **arrayBuffer**(): `Promise`\<`ArrayBuffer`\> -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4472 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4472 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) @@ -199,7 +197,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4472 > **blob**(): `Promise`\<`Blob`\> -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4474 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4474 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) @@ -217,7 +215,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4474 > **bytes**(): `Promise`\<`Uint8Array`\<`ArrayBuffer`\>\> -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4476 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4476 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) @@ -235,7 +233,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4476 > **clone**(): `Response` -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:26364 +Source: 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. @@ -255,7 +253,7 @@ The `clone()` method of the Response interface creates a clone of a response obj > **formData**(): `Promise`\<`FormData`\> -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4478 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4478 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) @@ -273,7 +271,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4478 > **json**(): `Promise`\<`any`\> -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4480 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4480 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) @@ -291,7 +289,7 @@ Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4480 > **text**(): `Promise`\<`string`\> -Defined in: node\_modules/typescript/lib/lib.dom.d.ts:4482 +Source: node\_modules/typescript/lib/lib.dom.d.ts:4482 [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) diff --git a/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx b/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx index 6b250caa9c..5b08ae59cb 100644 --- a/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx +++ b/weave/reference/typescript-sdk/interfaces/httpvalidationerror.mdx @@ -3,16 +3,36 @@ title: "HTTPValidationError" description: "TypeScript SDK reference" --- -HTTPValidationError +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/generated/traceServerApi.ts:4075](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L4075) +HTTPValidationError ## Properties ### detail -> `optional` **detail**: `ValidationError`[] +> `optional` **detail**: `object`[] + + Detail -Defined in: [src/generated/traceServerApi.ts:4077](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L4077) +#### loc + +> **loc**: (`string` \| `number`)[] + +Location + +#### msg + +> **msg**: `string` + +Message + +#### type + +> **type**: `string` + +Error Type \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/llm.mdx b/weave/reference/typescript-sdk/interfaces/llm.mdx index d40e564711..f66f68c0d7 100644 --- a/weave/reference/typescript-sdk/interfaces/llm.mdx +++ b/weave/reference/typescript-sdk/interfaces/llm.mdx @@ -3,6 +3,10 @@ title: "LLM" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + An LLM call. Emits a `chat` span with `gen_ai.*` attributes. Created by `weave.startLLM()` (or `turn.startLLM()`) and terminated with @@ -14,8 +18,6 @@ or via the helper functions (`output`, `think`, `attachMedia`, `record`). All recorded data is flushed to the span at `end()`. -Defined in: [src/genai/llm.ts:86](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L86) - ## Examples ```ts twoslash @@ -58,18 +60,18 @@ try { > **inputMessages**: [`Message`](./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) + *** @@ -77,18 +79,18 @@ Defined in: [src/genai/llm.ts:117](https://github.com/wandb/weave/blob/8c5f077eb > **outputMessages**: [`Message`](./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) + *** @@ -96,20 +98,20 @@ Defined in: [src/genai/llm.ts:118](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **reasoning**: [`Reasoning`](./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`](./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) +Token counts and cache stats. Flushed to `gen_ai.usage.*` on `end()`. ## Methods @@ -124,25 +126,19 @@ See https://opentelemetry.io/blog/2026/deprecating-span-events/ > **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`. -Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - #### Parameters -##### name + -`string` + -##### attributes? - -`Attributes` - -##### startTime? - -`TimeInput` + #### Returns @@ -165,18 +161,20 @@ span.addEvent('context_compacted', {removedMessages: 12}); > **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()`. -Defined in: [src/genai/llm.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L183) - #### Parameters -##### opts + + See [`Modality`](../type-aliases/modality), [`Modality`](../type-aliases/modality), [`Modality`](../type-aliases/modality). -`AttachMediaOpts` + Full type: `{ content: string; mimeType: string; modality: Modality; } | { modality: Modality; uri: string; } | { fileId: string; mimeType?: string; modality: Modality; }` + #### Returns @@ -188,21 +186,21 @@ Defined in: [src/genai/llm.ts:183](https://github.com/wandb/weave/blob/8c5f077eb > **attachMediaUrl**(`url`, `opts`): `this` -Convenience for `attachMedia({uri, modality})`. + -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) + + + + See [`Modality`](../type-aliases/modality). + + + #### Returns @@ -214,15 +212,19 @@ Defined in: [src/genai/llm.ts:192](https://github.com/wandb/weave/blob/8c5f077eb > **end**(`opts?`): `void` -Flush accumulated state and close the span. Idempotent. Pass `error` to mark failed; pass `endTime` to backdate the close. + -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 @@ -234,15 +236,13 @@ Defined in: [src/genai/llm.ts:274](https://github.com/wandb/weave/blob/8c5f077eb > **output**(`content`): `this` -Append an assistant message to the response. + -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 @@ -254,50 +254,46 @@ Defined in: [src/genai/llm.ts:155](https://github.com/wandb/weave/blob/8c5f077eb > **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. -Defined in: [src/genai/llm.ts:203](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L203) - #### Parameters -##### opts - -###### finishReasons? - -`string`[] - -###### inputMessages? - -[`Message`](./message)[] - -###### mediaAttachments? - -`AttachMediaOpts`[] - -###### outputMessages? - -[`Message`](./message)[] - -###### outputType? + + + -`string` + + See [`Message`](./message). + -###### reasoning? + + See [`Modality`](../type-aliases/modality), [`Modality`](../type-aliases/modality), [`Modality`](../type-aliases/modality). -[`Reasoning`](./reasoning) + Full type: `({ content: string; mimeType: string; modality: Modality; } | { modality: Modality; uri: string; } | { fileId: string; mimeType?: string; modality: Modality; })[]` + -###### responseId? + + See [`Message`](./message). + -`string` + -###### responseModel? + + See [`Reasoning`](./reasoning). + -`string` + -###### usage? + -[`Usage`](./usage) + + See [`Usage`](./usage). + + + #### Returns @@ -309,17 +305,15 @@ Defined in: [src/genai/llm.ts:203](https://github.com/wandb/weave/blob/8c5f077eb > **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`). -Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - #### Parameters -##### attributes - -`Attributes` + #### Returns @@ -342,15 +336,15 @@ span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); > **startSubagent**(`opts`): [`SubAgent`](./subagent) -Start a child SubAgent span nested under this LLM. + -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) + + See [`SubAgentInit`](./subagentinit). + #### Returns @@ -362,15 +356,15 @@ Defined in: [src/genai/llm.ts:261](https://github.com/wandb/weave/blob/8c5f077eb > **startTool**(`opts`): [`Tool`](./tool) -Start a child Tool span nested under this LLM. + -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) + + See [`ToolInit`](./toolinit). + #### Returns @@ -382,18 +376,16 @@ Defined in: [src/genai/llm.ts:252](https://github.com/wandb/weave/blob/8c5f077eb > **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. -Defined in: [src/genai/llm.ts:167](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L167) - #### Parameters -##### content - -`string` + #### Returns diff --git a/weave/reference/typescript-sdk/interfaces/llminit.mdx b/weave/reference/typescript-sdk/interfaces/llminit.mdx index 80010cb37e..acabf5d008 100644 --- a/weave/reference/typescript-sdk/interfaces/llminit.mdx +++ b/weave/reference/typescript-sdk/interfaces/llminit.mdx @@ -3,7 +3,9 @@ title: "LLMInit" description: "TypeScript SDK reference" --- -Defined in: [src/genai/llm.ts:36](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L36) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,7 +17,7 @@ Defined in: [src/genai/llm.ts:36](https://github.com/wandb/weave/blob/8c5f077eb1 > **model**: `string` -Defined in: [src/genai/llm.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L37) + *** @@ -23,7 +25,7 @@ Defined in: [src/genai/llm.ts:37](https://github.com/wandb/weave/blob/8c5f077eb1 > `optional` **providerName**: `string` -Defined in: [src/genai/llm.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/llm.ts#L38) + *** @@ -31,7 +33,7 @@ Defined in: [src/genai/llm.ts:38](https://github.com/wandb/weave/blob/8c5f077eb1 > `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 @@ -43,4 +45,4 @@ Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f0 > `optional` **systemInstructions**: `string`[] -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 a956998876..3c30facf4a 100644 --- a/weave/reference/typescript-sdk/interfaces/message.mdx +++ b/weave/reference/typescript-sdk/interfaces/message.mdx @@ -3,7 +3,9 @@ title: "Message" description: "TypeScript SDK reference" --- -Defined in: [src/genai/types.ts:15](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L15) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Properties @@ -11,7 +13,7 @@ Defined in: [src/genai/types.ts:15](https://github.com/wandb/weave/blob/8c5f077e > `optional` **content**: `string` -Defined in: [src/genai/types.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L17) + *** @@ -19,7 +21,7 @@ Defined in: [src/genai/types.ts:17](https://github.com/wandb/weave/blob/8c5f077e > `optional` **parts**: [`MessagePart`](../type-aliases/messagepart)[] -Defined in: [src/genai/types.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L20) + *** @@ -27,7 +29,7 @@ Defined in: [src/genai/types.ts:20](https://github.com/wandb/weave/blob/8c5f077e > **role**: [`Role`](../type-aliases/role) -Defined in: [src/genai/types.ts:16](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L16) + *** @@ -35,7 +37,7 @@ Defined in: [src/genai/types.ts:16](https://github.com/wandb/weave/blob/8c5f077e > `optional` **toolCallId**: `string` -Defined in: [src/genai/types.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L18) + *** @@ -43,4 +45,4 @@ Defined in: [src/genai/types.ts:18](https://github.com/wandb/weave/blob/8c5f077e > `optional` **toolName**: `string` -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 36731a7630..e048dfdf8f 100644 --- a/weave/reference/typescript-sdk/interfaces/query.mdx +++ b/weave/reference/typescript-sdk/interfaces/query.mdx @@ -3,16 +3,685 @@ title: "Query" description: "TypeScript SDK reference" --- -Query +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/generated/traceServerApi.ts:5222](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5222) +Query ## Properties ### $expr -> **$expr**: `AndOperation` \| `OrOperation` \| `NotOperation` \| `EqOperation` \| `GtOperation` \| `LtOperation` \| `GteOperation` \| `LteOperation` \| `InOperation` \| `ContainsOperation` +> **$expr**: \{ `$and`: (AndOperation \| \{ `$or`: (AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation)\[\]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `substr`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \} \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \})[]; \} \| \{ `$or`: (\{ `$and`: (AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation)\[\]; \} \| OrOperation \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `substr`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \} \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \})[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: \{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| ContainsOperation \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; `substr`: \{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| ContainsOperation \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \}; \} + + $Expr -Defined in: [src/generated/traceServerApi.ts:5224](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5224) +#### Union Members + +##### Type Literal + +\{ `$and`: (AndOperation \| \{ `$or`: (AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation)\[\]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `substr`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \} \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \})[]; \} + +##### $and + +> **$and**: (AndOperation \| \{ `$or`: (AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation)\[\]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `substr`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \} \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \})[] + +$And + +*** + +##### Type Literal + +\{ `$or`: (\{ `$and`: (AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation)\[\]; \} \| OrOperation \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `substr`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \} \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \})[]; \} + +##### $or + +> **$or**: (\{ `$and`: (AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation)\[\]; \} \| OrOperation \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| \{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `substr`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \} \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \})[] + +$Or + +*** + +##### Type Literal + +\{ `$not`: `any`[]; \} + +##### $not + +> **$not**: `any`[] + +$Not + +###### Max Items + +1 + +###### Min Items + +1 + +*** + +##### Type Literal + +\{ `$eq`: `any`[]; \} + +##### $eq + +> **$eq**: `any`[] + +$Eq + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +##### Type Literal + +\{ `$gt`: `any`[]; \} + +##### $gt + +> **$gt**: `any`[] + +$Gt + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +##### Type Literal + +\{ `$lt`: `any`[]; \} + +##### $lt + +> **$lt**: `any`[] + +$Lt + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +##### Type Literal + +\{ `$gte`: `any`[]; \} + +##### $gte + +> **$gte**: `any`[] + +$Gte + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +##### Type Literal + +\{ `$lte`: `any`[]; \} + +##### $lte + +> **$lte**: `any`[] + +$Lte + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +##### Type Literal + +\{ `$in`: `any`[]; \} + +##### $in + +> **$in**: `any`[] + +$In + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +##### Type Literal + +\{ `$contains`: \{ `case_insensitive?`: `boolean` \| `null`; `input`: \{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| ContainsOperation \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; `substr`: \{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| ContainsOperation \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \}; \}; \} + +##### $contains + +> **$contains**: `object` + +Specification for the `$contains` operation. + +- `input`: The string to search. +- `substr`: The substring to search for. +- `case_insensitive`: If true, match is case-insensitive. + +###### $contains.case\_insensitive + +> `optional` **case\_insensitive**: `boolean` \| `null` + +Case Insensitive + +###### Default + +```ts twoslash +// @noErrors +false +``` + +###### $contains.input + +> **input**: \{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| ContainsOperation \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \} + +Input + +###### Union Members + +###### Type Literal + +\{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} + +###### $and + +> **$and**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[] + +$And + +*** + +###### Type Literal + +\{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} + +###### $or + +> **$or**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[] + +$Or + +*** + +###### Type Literal + +\{ `$not`: `any`[]; \} + +###### $not + +> **$not**: `any`[] + +$Not + +###### Max Items + +1 + +###### Min Items + +1 + +*** + +###### Type Literal + +\{ `$eq`: `any`[]; \} + +###### $eq + +> **$eq**: `any`[] + +$Eq + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$gt`: `any`[]; \} + +###### $gt + +> **$gt**: `any`[] + +$Gt + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$lt`: `any`[]; \} + +###### $lt + +> **$lt**: `any`[] + +$Lt + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$gte`: `any`[]; \} + +###### $gte + +> **$gte**: `any`[] + +$Gte + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$lte`: `any`[]; \} + +###### $lte + +> **$lte**: `any`[] + +$Lte + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$in`: `any`[]; \} + +###### $in + +> **$in**: `any`[] + +$In + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +ContainsOperation + +*** + +###### Type Literal + +\{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} + +###### $literal + +> **$literal**: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null` + +$Literal + +*** + +###### Type Literal + +\{ `$getField`: `string`; \} + +###### $getField + +> **$getField**: `string` + +$Getfield + +*** + +###### Type Literal + +\{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} + +###### $convert + +> **$convert**: `object` + +Specifies conversion details for `$convert`. + +- `input`: The operand to convert. +- `to`: The type to convert to. + +###### $convert.input + +> **input**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation + +Input + +###### $convert.to + +> **to**: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"` + +To + +*** + +###### Type Literal + +\{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \} + +###### $size + +> **$size**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation + +$Size + +###### $contains.substr + +> **substr**: \{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} \| \{ `$not`: `any`[]; \} \| \{ `$eq`: `any`[]; \} \| \{ `$gt`: `any`[]; \} \| \{ `$lt`: `any`[]; \} \| \{ `$gte`: `any`[]; \} \| \{ `$lte`: `any`[]; \} \| \{ `$in`: `any`[]; \} \| ContainsOperation \| \{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} \| \{ `$getField`: `string`; \} \| \{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} \| \{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \} + +Substr + +###### Union Members + +###### Type Literal + +\{ `$and`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} + +###### $and + +> **$and**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[] + +$And + +*** + +###### Type Literal + +\{ `$or`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[]; \} + +###### $or + +> **$or**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation[] + +$Or + +*** + +###### Type Literal + +\{ `$not`: `any`[]; \} + +###### $not + +> **$not**: `any`[] + +$Not + +###### Max Items + +1 + +###### Min Items + +1 + +*** + +###### Type Literal + +\{ `$eq`: `any`[]; \} + +###### $eq + +> **$eq**: `any`[] + +$Eq + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$gt`: `any`[]; \} + +###### $gt + +> **$gt**: `any`[] + +$Gt + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$lt`: `any`[]; \} + +###### $lt + +> **$lt**: `any`[] + +$Lt + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$gte`: `any`[]; \} + +###### $gte + +> **$gte**: `any`[] + +$Gte + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$lte`: `any`[]; \} + +###### $lte + +> **$lte**: `any`[] + +$Lte + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +###### Type Literal + +\{ `$in`: `any`[]; \} + +###### $in + +> **$in**: `any`[] + +$In + +###### Max Items + +2 + +###### Min Items + +2 + +*** + +ContainsOperation + +*** + +###### Type Literal + +\{ `$literal`: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null`; \} + +###### $literal + +> **$literal**: `string` \| `number` \| `boolean` \| `Record`\<`string`, LiteralOperation\> \| LiteralOperation[] \| `null` + +$Literal + +*** + +###### Type Literal + +\{ `$getField`: `string`; \} + +###### $getField + +> **$getField**: `string` + +$Getfield + +*** + +###### Type Literal + +\{ `$convert`: \{ `input`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; `to`: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"`; \}; \} + +###### $convert + +> **$convert**: `object` + +Specifies conversion details for `$convert`. + +- `input`: The operand to convert. +- `to`: The type to convert to. + +###### $convert.input + +> **input**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation + +Input + +###### $convert.to + +> **to**: `"string"` \| `"double"` \| `"int"` \| `"bool"` \| `"exists"` + +To + +*** + +###### Type Literal + +\{ `$size`: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation; \} + +###### $size + +> **$size**: AndOperation \| OrOperation \| NotOperation \| EqOperation \| GtOperation \| LtOperation \| GteOperation \| ... 6 more ... \| SizeOperation + +$Size \ 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 5a6929669b..6e46015c40 100644 --- a/weave/reference/typescript-sdk/interfaces/reasoning.mdx +++ b/weave/reference/typescript-sdk/interfaces/reasoning.mdx @@ -3,7 +3,9 @@ title: "Reasoning" description: "TypeScript SDK reference" --- -Defined in: [src/genai/types.ts:45](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L45) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Properties @@ -11,4 +13,4 @@ Defined in: [src/genai/types.ts:45](https://github.com/wandb/weave/blob/8c5f077e > **content**: `string` -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/registercustomruntimeoptions.mdx b/weave/reference/typescript-sdk/interfaces/registercustomruntimeoptions.mdx new file mode 100644 index 0000000000..4a1da35875 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/registercustomruntimeoptions.mdx @@ -0,0 +1,50 @@ +--- +title: "RegisterCustomRuntimeOptions" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + +## Properties + +### apiKeySecret + +> `optional` **apiKeySecret**: `string` + + + +*** + +### baseUrl + +> **baseUrl**: `string` + + + +*** + +### headers + +> `optional` **headers**: `Readonly`\<`Record`\<`string`, `string`\>\> + + + +*** + +### name + +> **name**: `string` + + + +*** + +### runtimeIds + +> **runtimeIds**: readonly (`string` \| [`CustomRuntimeId`](./customruntimeid))[] + + + +Complete desired list; omitted IDs are removed from an existing runtime. \ 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 5bd97bc6d7..c4dbeb58f3 100644 --- a/weave/reference/typescript-sdk/interfaces/sortby.mdx +++ b/weave/reference/typescript-sdk/interfaces/sortby.mdx @@ -3,9 +3,11 @@ title: "SortBy" description: "TypeScript SDK reference" --- -SortBy +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + -Defined in: [src/generated/traceServerApi.ts:5536](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5536) +SortBy ## Properties @@ -13,9 +15,9 @@ Defined in: [src/generated/traceServerApi.ts:5536](https://github.com/wandb/weav > **direction**: `"asc"` \| `"desc"` -Direction + -Defined in: [src/generated/traceServerApi.ts:5540](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5540) +Direction *** @@ -23,6 +25,6 @@ Defined in: [src/generated/traceServerApi.ts:5540](https://github.com/wandb/weav > **field**: `string` -Field + -Defined in: [src/generated/traceServerApi.ts:5538](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/generated/traceServerApi.ts#L5538) +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 index 3e17dbf0d3..6f9806dfe0 100644 --- a/weave/reference/typescript-sdk/interfaces/subagent.mdx +++ b/weave/reference/typescript-sdk/interfaces/subagent.mdx @@ -3,7 +3,9 @@ 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) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -17,7 +19,7 @@ Defined in: [src/genai/subagent.ts:65](https://github.com/wandb/weave/blob/8c5f0 > **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 @@ -31,7 +33,7 @@ Defined in: [src/genai/subagent.ts:78](https://github.com/wandb/weave/blob/8c5f0 > **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 @@ -50,25 +52,19 @@ See https://opentelemetry.io/blog/2026/deprecating-span-events/ > **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`. -Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - #### Parameters -##### name - -`string` - -##### attributes? + -`Attributes` + -##### startTime? - -`TimeInput` + #### Returns @@ -91,17 +87,21 @@ span.addEvent('context_compacted', {removedMessages: 12}); > **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. -Defined in: [src/genai/subagent.ts:153](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L153) - #### Parameters -##### opts? + + + -`SpanEndOptions` + + + #### Returns @@ -113,37 +113,36 @@ Defined in: [src/genai/subagent.ts:153](https://github.com/wandb/weave/blob/8c5f > **record**(`opts`): `this` -Bulk-set any fields. Replaces (does not merge). + -Defined in: [src/genai/subagent.ts:117](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L117) +Bulk-set any subset of the mutable fields. Replaces (does not merge). +Input and output messages are serialized when the span ends. #### Parameters -##### opts + + + -###### agentDescription? + -`string` + -###### agentId? + + See [`Message`](./message). + -`string` + -###### agentVersion? + -`string` - -###### model? - -`string` + + See [`Message`](./message). + -###### name? - -`string` - -###### systemInstructions? - -`string`[] + + + #### Returns @@ -155,17 +154,15 @@ Defined in: [src/genai/subagent.ts:117](https://github.com/wandb/weave/blob/8c5f > **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`). -Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - #### Parameters -##### attributes - -`Attributes` + #### Returns @@ -180,4 +177,64 @@ span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); #### Inherited from -`SpanBase.setAttributes` \ No newline at end of file +`SpanBase.setAttributes` + +*** + +### startLLM() + +> **startLLM**(`opts`): [`LLM`](./llm) + + + +Start a child LLM span nested under this SubAgent. + +#### Parameters + + + See [`LLMInit`](./llminit). + + +#### Returns + +[`LLM`](./llm) + +*** + +### startSubagent() + +> **startSubagent**(`opts`): `SubAgent` + + + +Start a nested SubAgent span under this SubAgent. + +#### Parameters + + + See [`SubAgentInit`](./subagentinit). + + +#### Returns + +`SubAgent` + +*** + +### startTool() + +> **startTool**(`opts`): [`Tool`](./tool) + + + +Start a child Tool span nested under this SubAgent. + +#### Parameters + + + See [`ToolInit`](./toolinit). + + +#### Returns + +[`Tool`](./tool) \ 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 2e5bebf1ea..11d1da82ac 100644 --- a/weave/reference/typescript-sdk/interfaces/subagentinit.mdx +++ b/weave/reference/typescript-sdk/interfaces/subagentinit.mdx @@ -3,7 +3,9 @@ title: "SubAgentInit" description: "TypeScript SDK reference" --- -Defined in: [src/genai/subagent.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L19) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,7 +17,7 @@ Defined in: [src/genai/subagent.ts:19](https://github.com/wandb/weave/blob/8c5f0 > `optional` **agentDescription**: `string` -Defined in: [src/genai/subagent.ts:24](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L24) + *** @@ -23,7 +25,7 @@ Defined in: [src/genai/subagent.ts:24](https://github.com/wandb/weave/blob/8c5f0 > `optional` **agentId**: `string` -Defined in: [src/genai/subagent.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L23) + *** @@ -31,7 +33,7 @@ Defined in: [src/genai/subagent.ts:23](https://github.com/wandb/weave/blob/8c5f0 > `optional` **agentVersion**: `string` -Defined in: [src/genai/subagent.ts:25](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L25) + *** @@ -39,7 +41,7 @@ Defined in: [src/genai/subagent.ts:25](https://github.com/wandb/weave/blob/8c5f0 > `optional` **model**: `string` -Defined in: [src/genai/subagent.ts:21](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L21) + *** @@ -47,7 +49,7 @@ Defined in: [src/genai/subagent.ts:21](https://github.com/wandb/weave/blob/8c5f0 > **name**: `string` -Defined in: [src/genai/subagent.ts:20](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/subagent.ts#L20) + *** @@ -55,7 +57,7 @@ Defined in: [src/genai/subagent.ts:20](https://github.com/wandb/weave/blob/8c5f0 > `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 @@ -67,4 +69,4 @@ Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f0 > `optional` **systemInstructions**: `string`[] -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 index 0426626dd0..f597b685cf 100644 --- a/weave/reference/typescript-sdk/interfaces/tool.mdx +++ b/weave/reference/typescript-sdk/interfaces/tool.mdx @@ -3,28 +3,29 @@ title: "Tool" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + A tool invocation. Emits an `execute_tool` span carrying the tool name, -the JSON-encoded arguments, the tool-call id, and the result. +the arguments, the tool-call id, and the result. String arguments and +results are recorded as-is; other JSON values are serialized. 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. - -Defined in: [src/genai/tool.ts:43](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L43) +`llm.startTool()`) and terminated with `end()`, which accepts the result and +optional error metadata. ## Example ```ts twoslash // @noErrors -const tool = weave.startTool({ - name: tc.function.name, - args: tc.function.arguments, - toolCallId: tc.id, -}); +const tool = weave.startTool({name: 'get_weather', args: {city: 'Tokyo'}}); try { - tool.result = await wikipediaSearch(JSON.parse(tc.function.arguments)); -} finally { - tool.end(); + const result = await getWeather('Tokyo'); + tool.end({result}); +} catch (error) { + tool.end({error: error as Error, errorType: 'weather_error'}); + throw error; } ``` @@ -38,7 +39,7 @@ try { > `readonly` **args**: `string` -Defined in: [src/genai/tool.ts:52](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L52) + *** @@ -46,17 +47,21 @@ Defined in: [src/genai/tool.ts:52](https://github.com/wandb/weave/blob/8c5f077eb > `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 +### ~~result~~ + + + **Deprecated.** Pass `result` to `end()` instead. + > `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) +Tool output as a string. Prefer passing `result` to `end()`. *** @@ -64,7 +69,7 @@ Defined in: [src/genai/tool.ts:47](https://github.com/wandb/weave/blob/8c5f077eb > `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 @@ -79,25 +84,19 @@ See https://opentelemetry.io/blog/2026/deprecating-span-events/ > **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`. -Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - #### Parameters -##### name + -`string` + -##### attributes? - -`Attributes` - -##### startTime? - -`TimeInput` + #### Returns @@ -120,16 +119,16 @@ span.addEvent('context_compacted', {removedMessages: 12}); > **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. + -Defined in: [src/genai/tool.ts:87](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L87) +Record an optional result and error type, then close the span. Idempotent. +Pass `error` to mark the span as failed and `endTime` to backdate the close. #### Parameters -##### opts? - -`SpanEndOptions` + + See [`ToolEndOptions`](./toolendoptions). + #### Returns @@ -141,17 +140,15 @@ Defined in: [src/genai/tool.ts:87](https://github.com/wandb/weave/blob/8c5f077eb > **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`). -Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - #### Parameters -##### attributes - -`Attributes` + #### Returns diff --git a/weave/reference/typescript-sdk/interfaces/toolendoptions.mdx b/weave/reference/typescript-sdk/interfaces/toolendoptions.mdx new file mode 100644 index 0000000000..227b4a8f00 --- /dev/null +++ b/weave/reference/typescript-sdk/interfaces/toolendoptions.mdx @@ -0,0 +1,56 @@ +--- +title: "ToolEndOptions" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + +## Extends + +- `SpanEndOptions` + +## Properties + +### endTime + +> `optional` **endTime**: `TimeInput` + + + +#### Inherited from + +`SpanEndOptions.endTime` + +*** + +### error + +> `optional` **error**: `Error` + + + +#### Inherited from + +`SpanEndOptions.error` + +*** + +### errorType + +> `optional` **errorType**: `string` + + + +Stable failure classification recorded on the `error.type` attribute. + +*** + +### result + +> `optional` **result**: [`JsonValue`](../type-aliases/jsonvalue) + + + +A JSON value. Strings are recorded as-is; other values are serialized. \ 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 aebab5114b..1ff139f541 100644 --- a/weave/reference/typescript-sdk/interfaces/toolinit.mdx +++ b/weave/reference/typescript-sdk/interfaces/toolinit.mdx @@ -3,7 +3,9 @@ title: "ToolInit" description: "TypeScript SDK reference" --- -Defined in: [src/genai/tool.ts:17](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L17) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -13,9 +15,11 @@ Defined in: [src/genai/tool.ts:17](https://github.com/wandb/weave/blob/8c5f077eb ### args -> `optional` **args**: `string` +> `optional` **args**: `string` \| [`JsonObject`](../type-aliases/jsonobject) + + -Defined in: [src/genai/tool.ts:19](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L19) +A JSON object, or a pre-serialized string recorded as-is. *** @@ -23,7 +27,7 @@ Defined in: [src/genai/tool.ts:19](https://github.com/wandb/weave/blob/8c5f077eb > **name**: `string` -Defined in: [src/genai/tool.ts:18](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/tool.ts#L18) + *** @@ -31,7 +35,7 @@ Defined in: [src/genai/tool.ts:18](https://github.com/wandb/weave/blob/8c5f077eb > `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 @@ -43,4 +47,4 @@ Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f0 > `optional` **toolCallId**: `string` -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 index 1508390624..ae15044675 100644 --- a/weave/reference/typescript-sdk/interfaces/turn.mdx +++ b/weave/reference/typescript-sdk/interfaces/turn.mdx @@ -3,7 +3,57 @@ 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) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + + +An agent invocation. Typically wraps the work to respond to a single +user message. Emits an `invoke_agent` span and acts as the root of the +trace for that turn: it is always started under `ROOT_CONTEXT` so it +never accidentally inherits a parent from another OTel-instrumented +library. + +Created by `weave.startTurn()` (or `conversation.startTurn()`) and +terminated with `end()`. Only one Turn may be active in an async chain. +Children (LLM, Tool, SubAgent) attach via the `startLLM`, `startTool`, +`startSubagent` methods. + +## Examples + +```ts twoslash +// @noErrors +const turn = weave.startTurn(); + +try { + const llm = turn.startLLM({model: 'gpt-4o', providerName: 'openai'}); + // ... + llm.end(); +} finally { + turn.end(); +} +``` + +```ts twoslash +// @noErrors +const turn = weave.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'), +}); + +try { + const llm = turn.startLLM({model: 'gpt-4o', providerName: 'openai'}); + // ... + llm.end(); +} finally { + turn.end(); +} +``` ## Extends @@ -17,7 +67,7 @@ Defined in: [src/genai/turn.ts:92](https://github.com/wandb/weave/blob/8c5f077eb > **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 @@ -31,7 +81,7 @@ Defined in: [src/genai/turn.ts:103](https://github.com/wandb/weave/blob/8c5f077e > **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 @@ -50,25 +100,19 @@ See https://opentelemetry.io/blog/2026/deprecating-span-events/ > **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`. -Defined in: [src/genai/spanBase.ts:82](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L82) - #### Parameters -##### name - -`string` - -##### attributes? - -`Attributes` + -##### startTime? + -`TimeInput` + #### Returns @@ -91,17 +135,21 @@ span.addEvent('context_compacted', {removedMessages: 12}); > **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. -Defined in: [src/genai/turn.ts:241](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L241) - #### Parameters -##### opts? + + + -`SpanEndOptions` + + + #### Returns @@ -113,42 +161,36 @@ Defined in: [src/genai/turn.ts:241](https://github.com/wandb/weave/blob/8c5f077e > **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. -Defined in: [src/genai/turn.ts:201](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L201) - #### Parameters -##### opts + + + -###### agentDescription? + -`string` + -###### agentId? + -`string` + + See [`Message`](./message). + -###### agentName? + -`string` + + See [`Message`](./message). + -###### agentVersion? - -`string` - -###### messages? - -[`Message`](./message)[] - -###### model? - -`string` - -###### systemInstructions? - -`string`[] + + + #### Returns @@ -167,17 +209,13 @@ 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 @@ -189,17 +227,15 @@ Defined in: [src/genai/turn.ts:193](https://github.com/wandb/weave/blob/8c5f077e > **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`). -Defined in: [src/genai/spanBase.ts:63](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/spanBase.ts#L63) - #### Parameters -##### attributes - -`Attributes` + #### Returns @@ -222,15 +258,15 @@ span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id}); > **startLLM**(`opts`): [`LLM`](./llm) -Start a child LLM span under this Turn. + -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) + + See [`LLMInit`](./llminit). + #### Returns @@ -242,15 +278,15 @@ Defined in: [src/genai/turn.ts:161](https://github.com/wandb/weave/blob/8c5f077e > **startSubagent**(`opts`): [`SubAgent`](./subagent) -Start a child SubAgent span under this Turn. + -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) + + See [`SubAgentInit`](./subagentinit). + #### Returns @@ -262,15 +298,15 @@ Defined in: [src/genai/turn.ts:179](https://github.com/wandb/weave/blob/8c5f077e > **startTool**(`opts`): [`Tool`](./tool) -Start a child Tool span under this Turn. + -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) + + See [`ToolInit`](./toolinit). + #### Returns diff --git a/weave/reference/typescript-sdk/interfaces/turninit.mdx b/weave/reference/typescript-sdk/interfaces/turninit.mdx index 43c86fdaa1..83a474829b 100644 --- a/weave/reference/typescript-sdk/interfaces/turninit.mdx +++ b/weave/reference/typescript-sdk/interfaces/turninit.mdx @@ -3,7 +3,9 @@ title: "TurnInit" description: "TypeScript SDK reference" --- -Defined in: [src/genai/turn.ts:31](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L31) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,7 +17,7 @@ Defined in: [src/genai/turn.ts:31](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **agentDescription**: `string` -Defined in: [src/genai/turn.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L37) + *** @@ -23,7 +25,7 @@ Defined in: [src/genai/turn.ts:37](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **agentId**: `string` -Defined in: [src/genai/turn.ts:35](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L35) + *** @@ -31,7 +33,7 @@ Defined in: [src/genai/turn.ts:35](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **agentName**: `string` -Defined in: [src/genai/turn.ts:36](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L36) + *** @@ -39,7 +41,19 @@ Defined in: [src/genai/turn.ts:36](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **agentVersion**: `string` -Defined in: [src/genai/turn.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L38) + + +*** + +### attributes + +> `optional` **attributes**: `Attributes` + + + +Custom attributes set on this turn and passed to every child span. +Normally seeded from the conversation via `startConversation({ attributes })`; +set here for a rootless `startTurn({ attributes })` with no conversation. *** @@ -47,7 +61,7 @@ Defined in: [src/genai/turn.ts:38](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **model**: `string` -Defined in: [src/genai/turn.ts:32](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L32) + *** @@ -55,7 +69,7 @@ Defined in: [src/genai/turn.ts:32](https://github.com/wandb/weave/blob/8c5f077eb > `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 @@ -67,7 +81,7 @@ Defined in: [src/genai/spanBase.ts:17](https://github.com/wandb/weave/blob/8c5f0 > `optional` **systemInstructions**: `string`[] -Defined in: [src/genai/turn.ts:33](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/turn.ts#L33) + *** @@ -75,4 +89,4 @@ Defined in: [src/genai/turn.ts:33](https://github.com/wandb/weave/blob/8c5f077eb > `optional` **userMessage**: `string` -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 baba93aea1..b0737d4db6 100644 --- a/weave/reference/typescript-sdk/interfaces/usage.mdx +++ b/weave/reference/typescript-sdk/interfaces/usage.mdx @@ -3,7 +3,9 @@ title: "Usage" description: "TypeScript SDK reference" --- -Defined in: [src/genai/types.ts:37](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L37) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Properties @@ -11,7 +13,7 @@ Defined in: [src/genai/types.ts:37](https://github.com/wandb/weave/blob/8c5f077e > `optional` **cacheCreationInputTokens**: `number` -Defined in: [src/genai/types.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L41) + *** @@ -19,7 +21,7 @@ Defined in: [src/genai/types.ts:41](https://github.com/wandb/weave/blob/8c5f077e > `optional` **cacheReadInputTokens**: `number` -Defined in: [src/genai/types.ts:42](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L42) + *** @@ -27,7 +29,7 @@ Defined in: [src/genai/types.ts:42](https://github.com/wandb/weave/blob/8c5f077e > `optional` **inputTokens**: `number` -Defined in: [src/genai/types.ts:38](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L38) + *** @@ -35,7 +37,7 @@ Defined in: [src/genai/types.ts:38](https://github.com/wandb/weave/blob/8c5f077e > `optional` **outputTokens**: `number` -Defined in: [src/genai/types.ts:39](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/types.ts#L39) + *** @@ -43,4 +45,4 @@ Defined in: [src/genai/types.ts:39](https://github.com/wandb/weave/blob/8c5f077e > `optional` **reasoningTokens**: `number` -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 95d1a32c95..afd478de29 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx @@ -3,7 +3,9 @@ title: "WeaveAudio" description: "TypeScript SDK reference" --- -Defined in: [src/media.ts:47](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L47) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,7 +17,7 @@ Defined in: [src/media.ts:47](https://github.com/wandb/weave/blob/8c5f077eb11c42 > **\_weaveType**: `"Audio"` -Defined in: [src/media.ts:48](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L48) + *** @@ -23,7 +25,7 @@ Defined in: [src/media.ts:48](https://github.com/wandb/weave/blob/8c5f077eb11c42 > `optional` **audioType**: `"wav"` -Defined in: [src/media.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L44) + #### Inherited from @@ -35,7 +37,7 @@ Defined in: [src/media.ts:44](https://github.com/wandb/weave/blob/8c5f077eb11c42 > **data**: `Buffer` -Defined in: [src/media.ts:43](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L43) + #### Inherited from diff --git a/weave/reference/typescript-sdk/interfaces/weaveclient.mdx b/weave/reference/typescript-sdk/interfaces/weaveclient.mdx index 2ec8369dc4..3eddee919e 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveclient.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveclient.mdx @@ -3,7 +3,9 @@ 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) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Properties @@ -11,114 +13,164 @@ Defined in: [src/weaveClient.ts:445](https://github.com/wandb/weave/blob/8c5f077 > **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) +> **settings**: `object` -Defined in: [src/weaveClient.ts:457](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L457) + -*** +#### attributes -### traceServerApi +> `readonly` **attributes**: `Record`\<`string`, `any`\> -> **traceServerApi**: `Api`\<`any`\> +A map of attributes applied to every trace produced by this client. -Defined in: [src/weaveClient.ts:455](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L455) +#### genai -## Methods +> `readonly` **genai**: `object` -### addScore() +##### genai.batchOptions -> **addScore**(`predictCallId`, `scorerCallId`, `runnableRefUri`, `scorerOutput`): `Promise`\<`string`\> +> `optional` **batchOptions**: `BufferConfig` -Add a scorer result (e.g., scorer output) to a call. -Used in imperative evaluation to attach scorer results to predict calls. +`BatchSpanProcessor` configuration. Ignored unless `spanProcessor === 'batch'`. -Defined in: [src/weaveClient.ts:1727](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1727) +##### genai.spanProcessor -#### Parameters +> `optional` **spanProcessor**: `"batch"` \| `"simple"` \| `SpanProcessor` -##### predictCallId +How GenAI spans are exported. -`string` +- `'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. -ID of the predict call to attach feedback to +#### printCallLink -##### scorerCallId +> `readonly` **printCallLink**: `boolean` -`string` +Prints links in terminal to Weave UI for ops. -ID of the scorer call that generated the feedback +##### Default -##### runnableRefUri +`true` -`string` +#### useCallsComplete -URI of the scorer (Op or Object ref) +> **useCallsComplete**: `boolean` -##### scorerOutput +Sends finished calls to the `calls/complete` endpoint (start+end paired +client-side) instead of the legacy `call/upsert_batch` path. -`any` +##### Default -Output of the scorer +`true` -#### Returns +#### useOTelV2 -`Promise`\<`string`\> +> **useOTelV2**: `boolean` + +Routes OTel-capable integrations through their OTel variant. + +##### Default + +`true` *** -### createCall() +### traceServerApi + +> **traceServerApi**: `Api`\<`any`\> -> **createCall**(`internalCall`, `opRef`, `params`, `parameterNames`, `thisArg`, `currentCall`, `parentCall`, `startTime`, `displayName?`, `attributes?`): `Promise`\<`void`\> + + +## Methods + +### addScore() + +> **addScore**(`predictCallId`, `scorerCallId`, `runnableRefUri`, `scorerOutput`): `Promise`\<`string`\> -Defined in: [src/weaveClient.ts:1570](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1570) + + +Add a scorer result (e.g., scorer output) to a call. +Used in imperative evaluation to attach scorer results to predict calls. #### Parameters -##### internalCall + + ID of the predict call to attach feedback to + + + + ID of the scorer call that generated the feedback + + + + URI of the scorer (Op or Object ref) + + + + Output of the scorer + -`InternalCall` +#### Returns -##### opRef +`Promise`\<`string`\> -`any` +*** -##### params +### createCall() -`any`[] +> **createCall**(`internalCall`, `opRef`, `params`, `parameterNames`, `thisArg`, `currentCall`, `parentCall`, `startTime`, `displayName?`, `attributes?`, `eagerCallStart?`): `Promise`\<`void`\> -##### parameterNames + -`ParameterNamesOption` +#### Parameters -##### thisArg + -`any` + -##### currentCall + -`CallStackEntry` + -##### parentCall + -`CallStackEntry` \| `undefined` + + + -##### startTime + -`Date` + -##### displayName? + -`string` + + + -##### attributes? + + Full type: `{ callId: string; childSummary: Record; displayName?: string; opName?: string; traceId: string; } | undefined` + -`Record`\<`string`, `any`\> + + + + + + + #### Returns @@ -130,37 +182,37 @@ Defined in: [src/weaveClient.ts:1570](https://github.com/wandb/weave/blob/8c5f07 > **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 + + Full type: `{ callId: string; childSummary: Record; displayName?: string; opName?: string; traceId: string; } | undefined` + -`Date` + -##### startCallPromise + -`Promise`\<`void`\> + #### Returns @@ -172,34 +224,50 @@ Defined in: [src/weaveClient.ts:1630](https://github.com/wandb/weave/blob/8c5f07 > **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` + + Full type: `{ callId: string; childSummary: Record; displayName?: string; opName?: string; traceId: string; } | undefined` + -##### endTime + -`Date` + -##### startCallPromise +#### Returns `Promise`\<`void`\> +*** + +### flush() + +> **flush**(): `Promise`\<`void`\> + + + +Deliver all buffered calls to the server. Await before `process.exit()`. + #### Returns `Promise`\<`void`\> @@ -210,13 +278,13 @@ Defined in: [src/weaveClient.ts:1672](https://github.com/wandb/weave/blob/8c5f07 > **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) + + See [`ObjectRef`](../classes/objectref). + #### Returns @@ -226,7 +294,9 @@ Defined in: [src/weaveClient.ts:1025](https://github.com/wandb/weave/blob/8c5f07 ### getAgentCustomAttributes() -> **getAgentCustomAttributes**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`GetAgentCustomAttributesResult`\>\> +> **getAgentCustomAttributes**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `attributes?`: `object`[]; `has_more?`: `boolean`; `limit?`: `number`; `offset?`: `number`; \}\>\> + + Discover typed custom-attribute keys observed on agent spans in the project. Each result row is one `(source, key, value_type)` triple plus @@ -237,17 +307,53 @@ 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. -Defined in: [src/weaveClient.ts:772](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L772) - #### Parameters -##### options + + + + **Min** + + 1 + + **Max** + + 2000 + + **Default** + + ```ts twoslash + // @noErrors + 200 + ``` + + + + **Min** + + 0 -`GetAgentCustomAttributesOptions` + **Default** + + ```ts twoslash + // @noErrors + 0 + ``` + + + + See [`Query`](./query). + + + + + + + #### Returns -`Promise`\<[`Response`](../type-aliases/response)\<`GetAgentCustomAttributesResult`\>\> +`Promise`\<[`Response`](../type-aliases/response)\<\{ `attributes?`: `object`[]; `has_more?`: `boolean`; `limit?`: `number`; `offset?`: `number`; \}\>\> #### Example @@ -275,15 +381,15 @@ for (const attr of resp.data.attributes ?? []) { > **getAgents**(`options?`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentsResult`](../type-aliases/getagentsresult)\>\> -List agents with aggregated stats. + -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) = `{}` + + See [`GetAgentsOptions`](./getagentsoptions). + #### Returns @@ -309,16 +415,16 @@ console.log(`total count: ${resp.data.total_count}`) > **getAgentSpans**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentSpansResult`](../type-aliases/getagentspansresult)\>\> + + Query agent spans, optionally filtered by agent name and/or a mongo-style query expression. -Defined in: [src/weaveClient.ts:566](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L566) - #### Parameters -##### options - -[`GetAgentSpansOptions`](./getagentspansoptions) + + See [`GetAgentSpansOptions`](./getagentspansoptions). + #### Returns @@ -356,7 +462,9 @@ for (const span of resp.data.spans) { ### getAgentSpanStats() -> **getAgentSpanStats**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`GetAgentSpanStatsResult`\>\> +> **getAgentSpanStats**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `bucket_type?`: `"number"` \| `"time"`; `columns?`: `object`[]; `end`: `string`; `granularity?`: `number` \| `null`; `rows?`: `Record`\<`string`, `string` \| `number` \| `boolean` \| `null`\>[]; `start`: `string`; `timezone`: `string`; \}\>\> + + Agregations over agent spans in the project, returned as rows + column metadata suitable for time-series / bucketed visualizations. @@ -368,17 +476,38 @@ bucket rows by time, or `groupBy` to break results out per agent / provider / model / etc. `query` filters the underlying spans before aggregation. -Defined in: [src/weaveClient.ts:621](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L621) - #### Parameters -##### options + + + -`GetAgentSpanStatsOptions` + + + + + + + + See [`Query`](./query). + + + + + + **Default** + + ```ts twoslash + // @noErrors + "UTC" + ``` + + + #### Returns -`Promise`\<[`Response`](../type-aliases/response)\<`GetAgentSpanStatsResult`\>\> +`Promise`\<[`Response`](../type-aliases/response)\<\{ `bucket_type?`: `"number"` \| `"time"`; `columns?`: `object`[]; `end`: `string`; `granularity?`: `number` \| `null`; `rows?`: `Record`\<`string`, `string` \| `number` \| `boolean` \| `null`\>[]; `start`: `string`; `timezone`: `string`; \}\>\> #### Example @@ -409,21 +538,21 @@ for (const row of resp.data.rows ?? []) { ### getAgentTurn() -> **getAgentTurn**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`AgentTraceChatRes`\>\> +> **getAgentTurn**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `agent_name?`: `string` \| `null`; `agent_version?`: `string` \| `null`; `feedback?`: `Record`\<`string`, `any`\>[] \| `null`; `messages?`: `object`[]; `provider?`: `string` \| `null`; `root_span_name?`: `string` \| `null`; `status_code?`: `"UNSET"` \| `"OK"` \| `"ERROR"` \| `null`; `total_cost_usd?`: `number` \| `null`; `total_duration_ms?`: `number` \| `null`; `trace_id`: `string`; \}\>\> -Get data (including messages) for a single turn (by traceId). + -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) + + See [`GetAgentTurnOptions`](./getagentturnoptions). + #### Returns -`Promise`\<[`Response`](../type-aliases/response)\<`AgentTraceChatRes`\>\> +`Promise`\<[`Response`](../type-aliases/response)\<\{ `agent_name?`: `string` \| `null`; `agent_version?`: `string` \| `null`; `feedback?`: `Record`\<`string`, `any`\>[] \| `null`; `messages?`: `object`[]; `provider?`: `string` \| `null`; `root_span_name?`: `string` \| `null`; `status_code?`: `"UNSET"` \| `"OK"` \| `"ERROR"` \| `null`; `total_cost_usd?`: `number` \| `null`; `total_duration_ms?`: `number` \| `null`; `trace_id`: `string`; \}\>\> #### Example @@ -449,15 +578,15 @@ for (const message of resp.data.messages ?? []) { > **getAgentTurns**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentTurnsResult`](../type-aliases/getagentturnsresult)\>\> -Get data (including messages) for many turns (by conversationId). + -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) + + See [`GetAgentTurnsOptions`](./getagentturnsoptions). + #### Returns @@ -491,15 +620,15 @@ console.log(`total turns: ${resp.data.total_turns}, has more: ${resp.data.has_mo > **getAgentVersions**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentVersionsResult`](../type-aliases/getagentversionsresult)\>\> -List versions for a given agent. + -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) + + See [`GetAgentVersionsOptions`](./getagentversionsoptions). + #### Returns @@ -523,23 +652,19 @@ console.log(`total count: ${resp.data.total_count}`) ### getCall() -> **getCall**(`callId`, `includeCosts?`): `Promise`\<`Call`\> +> **getCall**(`callId`, `includeCosts?`): `Promise`\<\{ `attributes`: `Record`\<`string`, `any`\>; `deleted_at?`: `string` \| `null`; `display_name?`: `string` \| `null`; `ended_at?`: `string` \| `null`; `exception?`: `string` \| `null`; `expire_at?`: `string` \| `null`; `id`: `string`; `inputs`: `Record`\<`string`, `any`\>; `op_name`: `string`; `output?`: `null`; `parent_id?`: `string` \| `null`; `project_id`: `string`; `started_at`: `string`; `storage_size_bytes?`: `number` \| `null`; `summary?`: `Record`\<`string`, `any`\>; `thread_id?`: `string` \| `null`; `total_storage_size_bytes?`: `number` \| `null`; `trace_id`: `string`; `turn_id?`: `string` \| `null`; `wb_run_id?`: `string` \| `null`; `wb_run_step?`: `number` \| `null`; `wb_run_step_end?`: `number` \| `null`; `wb_user_id?`: `string` \| `null`; `wb_username?`: `string` \| `null`; `setDisplayName`: `Promise`\<`void`\>; \}\> -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`\> +`Promise`\<\{ `attributes`: `Record`\<`string`, `any`\>; `deleted_at?`: `string` \| `null`; `display_name?`: `string` \| `null`; `ended_at?`: `string` \| `null`; `exception?`: `string` \| `null`; `expire_at?`: `string` \| `null`; `id`: `string`; `inputs`: `Record`\<`string`, `any`\>; `op_name`: `string`; `output?`: `null`; `parent_id?`: `string` \| `null`; `project_id`: `string`; `started_at`: `string`; `storage_size_bytes?`: `number` \| `null`; `summary?`: `Record`\<`string`, `any`\>; `thread_id?`: `string` \| `null`; `total_storage_size_bytes?`: `number` \| `null`; `trace_id`: `string`; `turn_id?`: `string` \| `null`; `wb_run_id?`: `string` \| `null`; `wb_run_step?`: `number` \| `null`; `wb_run_step_end?`: `number` \| `null`; `wb_user_id?`: `string` \| `null`; `wb_username?`: `string` \| `null`; `setDisplayName`: `Promise`\<`void`\>; \}\> *** @@ -547,43 +672,39 @@ Defined in: [src/weaveClient.ts:902](https://github.com/wandb/weave/blob/8c5f077 #### Call Signature -> **getCalls**(`options?`): `Promise`\<`Call`[]\> +> **getCalls**(`options?`): `Promise`\<`object`[]\> -Defined in: [src/weaveClient.ts:935](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L935) + ##### Parameters -###### options? - -[`GetCallsOptions`](./getcallsoptions) + + See [`GetCallsOptions`](./getcallsoptions). + ##### Returns -`Promise`\<`Call`[]\> +`Promise`\<`object`[]\> #### Call Signature -> **getCalls**(`options?`, `includeCosts?`, `limit?`): `Promise`\<`Call`[]\> +> **getCalls**(`options?`, `includeCosts?`, `limit?`): `Promise`\<`object`[]\> -Defined in: [src/weaveClient.ts:936](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L936) + ##### Parameters -###### options? + + See [`CallsFilter`](./callsfilter). + -[`CallsFilter`](./callsfilter) + -###### includeCosts? - -`boolean` - -###### limit? - -`number` + ##### Returns -`Promise`\<`Call`[]\> +`Promise`\<`object`[]\> *** @@ -593,21 +714,17 @@ Defined in: [src/weaveClient.ts:936](https://github.com/wandb/weave/blob/8c5f077 > **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? + + See [`CallsFilter`](./callsfilter). + -`boolean` + -###### limit? - -`number` + ##### Returns @@ -617,13 +734,13 @@ Defined in: [src/weaveClient.ts:957](https://github.com/wandb/weave/blob/8c5f077 > **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) + + See [`GetCallsOptions`](./getcallsoptions). + ##### Returns @@ -635,7 +752,7 @@ Defined in: [src/weaveClient.ts:962](https://github.com/wandb/weave/blob/8c5f077 > **getCallStack**(): `CallStack` -Defined in: [src/weaveClient.ts:1482](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1482) + #### Returns @@ -647,7 +764,7 @@ Defined in: [src/weaveClient.ts:1482](https://github.com/wandb/weave/blob/8c5f07 > **getCurrentAttributes**(): `Record`\<`string`, `any`\> -Defined in: [src/weaveClient.ts:1486](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1486) + #### Returns @@ -657,25 +774,43 @@ Defined in: [src/weaveClient.ts:1486](https://github.com/wandb/weave/blob/8c5f07 ### linkPromptToRegistry() -> **linkPromptToRegistry**(`prompt`, `options`): `Promise`\<`LinkAssetToRegistryRes`\> +> **linkPromptToRegistry**(`prompt`, `options`): `Promise`\<\{ `version_index`: `number` \| `null`; \}\> -Link a published prompt version into a registry portfolio. + -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 + + See [`ObjectRef`](../classes/objectref). + + + + + + + + + + +#### Returns + +`Promise`\<\{ `version_index`: `number` \| `null`; \}\> + +*** + +### pendingCallCount() -`RegistryLinkable` +> **pendingCallCount**(): `number` -##### options + -`LinkPromptToRegistryOptions` +Calls buffered client-side but not yet delivered to the server. #### Returns -`Promise`\<`LinkAssetToRegistryRes`\> +`number` *** @@ -683,17 +818,13 @@ Defined in: [src/weaveClient.ts:1181](https://github.com/wandb/weave/blob/8c5f07 > **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 @@ -705,23 +836,77 @@ Defined in: [src/weaveClient.ts:890](https://github.com/wandb/weave/blob/8c5f077 > **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.callId + + > **callId**: `string` + + ###### currentCall.childSummary + + > **childSummary**: `Record`\<`string`, `any`\> + + ###### currentCall.displayName + + > `optional` **displayName**: `string` + + ###### currentCall.opName + + > `optional` **opName**: `string` + + ###### currentCall.traceId -> **currentCall**: `CallStackEntry` + > **traceId**: `string` + -##### newStack + -> **newStack**: `CallStack` + + ###### parentCall.callId -##### parentCall + > **callId**: `string` -> `optional` **parentCall**: `CallStackEntry` + ###### parentCall.childSummary + + > **childSummary**: `Record`\<`string`, `any`\> + + ###### parentCall.displayName + + > `optional` **displayName**: `string` + + ###### parentCall.opName + + > `optional` **opName**: `string` + + ###### parentCall.traceId + + > **traceId**: `string` + + +*** + +### registerCustomRuntime() + +> **registerCustomRuntime**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `api_key_secret`: `string` \| `null`; `base_url`: `string`; `headers`: `Record`\<`string`, `string`\>; `name`: `string`; `runtime_ids`: `object`[]; \}\>\> + + + +Register a custom runtime, replacing its complete configuration if it exists. + +#### Parameters + + + See [`RegisterCustomRuntimeOptions`](./registercustomruntimeoptions). + + +#### Returns + +`Promise`\<[`Response`](../type-aliases/response)\<\{ `api_key_secret`: `string` \| `null`; `base_url`: `string`; `headers`: `Record`\<`string`, `string`\>; `name`: `string`; `runtime_ids`: `object`[]; \}\>\> *** @@ -729,23 +914,17 @@ Defined in: [src/weaveClient.ts:1490](https://github.com/wandb/weave/blob/8c5f07 > **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 @@ -757,23 +936,17 @@ Defined in: [src/weaveClient.ts:1498](https://github.com/wandb/weave/blob/8c5f07 > **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 @@ -785,13 +958,11 @@ Defined in: [src/weaveClient.ts:1494](https://github.com/wandb/weave/blob/8c5f07 > **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 @@ -801,15 +972,86 @@ Defined in: [src/weaveClient.ts:1477](https://github.com/wandb/weave/blob/8c5f07 ### saveCallStart() -> **saveCallStart**(`callStart`): `void` +> **saveCallStart**(`callStart`, `opts?`): `void` -Defined in: [src/weaveClient.ts:1472](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1472) + #### Parameters -##### callStart + + + + Attributes + + + + Display Name + + + + Id + + + + Inputs + + + + Op Name + + + + Otel Dump + + + + Parent Id + -`StartedCallSchemaForInsert` + + Project Id + + + + Started At + + **Format** + + date-time + + + + Thread Id + + + + Trace Id + + + + Turn Id + + + + Wb Run Id + + + + Wb Run Step + + + + Wb User Id + Do not set directly. Server will automatically populate this field. + + + + + + + + + #### Returns @@ -821,17 +1063,15 @@ Defined in: [src/weaveClient.ts:1472](https://github.com/wandb/weave/blob/8c5f07 > **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? + + See [`Op`](../type-aliases/op). + -`string` + #### Returns @@ -841,7 +1081,9 @@ Defined in: [src/weaveClient.ts:1537](https://github.com/wandb/weave/blob/8c5f07 ### searchAgents() -> **searchAgents**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<`SearchAgentsResult`\>\> +> **searchAgents**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `results`: `object`[]; `total_conversations?`: `number`; \}\>\> + + Full-text search across agent messages in the project. Returns hits grouped by conversation, with a preview of each matched message. @@ -851,17 +1093,57 @@ all messages matching the structured filters (`agentName`, `conversationId`, `traceId`) without text matching. Use `limit` / `offset` to page through results. -Defined in: [src/weaveClient.ts:730](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L730) - #### Parameters -##### options + + + + + + + + Limit + + **Min** + + 0 + + **Max** + + 1000 + + **Default** + + ```ts twoslash + // @noErrors + 20 + ``` + + + + Offset + + **Min** -`SearchAgentsOptions` + 0 + + **Default** + + ```ts twoslash + // @noErrors + 0 + ``` + + + + + + + #### Returns -`Promise`\<[`Response`](../type-aliases/response)\<`SearchAgentsResult`\>\> +`Promise`\<[`Response`](../type-aliases/response)\<\{ `results`: `object`[]; `total_conversations?`: `number`; \}\>\> #### Example @@ -888,7 +1170,9 @@ console.log(`total conversations: ${resp.data.total_conversations}`); ### serializeAudio() -> **serializeAudio**(`data`, `audioType?`): `Promise`\<`SerializedFileBlob`\> +> **serializeAudio**(`data`, `audioType?`): `Promise`\<\{ `_type`: `"CustomWeaveType"`; `files`: `Record`\<`string`, `string`\>; `load_op`: `string`; `weave_type`: \{ `type`: `string`; \}; \}\> + + Upload raw audio bytes to the Weave content store and return the `CustomWeaveType` placeholder that can be embedded in a call output. @@ -896,25 +1180,19 @@ Upload raw audio bytes to the Weave content store and return the Use this when building call outputs manually (e.g. via `saveCallEnd`) where the automatic serialization pipeline from `finishCall` is not used. -Defined in: [src/weaveClient.ts:1424](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L1424) - #### Parameters -##### data + + Raw audio bytes (WAV for best browser compatibility) + -`Buffer` - -Raw audio bytes (WAV for best browser compatibility) - -##### audioType? - -`"wav"` = `DEFAULT_AUDIO_TYPE` - -File format — currently only 'wav' is supported + + File format — currently only 'wav' is supported + #### Returns -`Promise`\<`SerializedFileBlob`\> +`Promise`\<\{ `_type`: `"CustomWeaveType"`; `files`: `Record`\<`string`, `string`\>; `load_op`: `string`; `weave_type`: \{ `type`: `string`; \}; \}\> *** @@ -922,17 +1200,13 @@ File format — currently only 'wav' is supported > **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 @@ -944,7 +1218,7 @@ Defined in: [src/weaveClient.ts:1710](https://github.com/wandb/weave/blob/8c5f07 > **waitForBatchProcessing**(): `Promise`\<`void`\> -Defined in: [src/weaveClient.ts:801](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L801) + #### Returns diff --git a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx index 65f09ab41a..56eef0ed79 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx @@ -3,7 +3,9 @@ title: "WeaveImage" description: "TypeScript SDK reference" --- -Defined in: [src/media.ts:13](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L13) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + + ## Extends @@ -15,7 +17,7 @@ Defined in: [src/media.ts:13](https://github.com/wandb/weave/blob/8c5f077eb11c42 > **\_weaveType**: `"Image"` -Defined in: [src/media.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L14) + *** @@ -23,7 +25,7 @@ Defined in: [src/media.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11c42 > **data**: `Buffer` -Defined in: [src/media.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L9) + #### Inherited from @@ -33,9 +35,9 @@ Defined in: [src/media.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b ### imageType -> `optional` **imageType**: `"png"` +> `optional` **imageType**: `"png"` \| `"jpeg"` \| `"webp"` -Defined in: [src/media.ts:10](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/media.ts#L10) + #### Inherited from diff --git a/weave/reference/typescript-sdk/type-aliases/agent.mdx b/weave/reference/typescript-sdk/type-aliases/agent.mdx index fae6e2b02c..f641af86e6 100644 --- a/weave/reference/typescript-sdk/type-aliases/agent.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agent.mdx @@ -3,6 +3,8 @@ title: "Agent" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **Agent** = `AgentSchema` -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 15fac03c4a..7e6c200e99 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentmessage.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentmessage.mdx @@ -3,6 +3,8 @@ title: "AgentMessage" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **AgentMessage** = `AgentChatMessageSchema` -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 f6e66981ba..95a0114e01 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentspan.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentspan.mdx @@ -3,6 +3,8 @@ title: "AgentSpan" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **AgentSpan** = `AgentSpanSchema` -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 553230f110..2a74855934 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentturn.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentturn.mdx @@ -3,6 +3,8 @@ title: "AgentTurn" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **AgentTurn** = `AgentTraceChatRes` -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 dbb838436b..60cf955ec6 100644 --- a/weave/reference/typescript-sdk/type-aliases/agentversion.mdx +++ b/weave/reference/typescript-sdk/type-aliases/agentversion.mdx @@ -3,6 +3,8 @@ title: "AgentVersion" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **AgentVersion** = `AgentVersionSchema` -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 ae551690d1..b3e20b413d 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentspansresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentspansresult.mdx @@ -3,11 +3,13 @@ title: "GetAgentSpansResult" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **GetAgentSpansResult** = `object` -Result shape returned by [WeaveClient.getAgentSpans](../interfaces/weaveclient#getagentspans). + -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](../interfaces/weaveclient#getagentspans). ## Properties @@ -15,7 +17,7 @@ Defined in: [src/weaveClient.ts:183](https://github.com/wandb/weave/blob/8c5f077 > **spans**: [`AgentSpan`](./agentspan)[] -Defined in: [src/weaveClient.ts:184](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L184) + *** @@ -23,4 +25,4 @@ Defined in: [src/weaveClient.ts:184](https://github.com/wandb/weave/blob/8c5f077 > `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 d524df6533..df4b4688f8 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentsresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentsresult.mdx @@ -3,11 +3,13 @@ title: "GetAgentsResult" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **GetAgentsResult** = `object` -Result shape returned by [WeaveClient.getAgents](../interfaces/weaveclient#getagents). + -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](../interfaces/weaveclient#getagents). ## Properties @@ -15,7 +17,7 @@ Defined in: [src/weaveClient.ts:125](https://github.com/wandb/weave/blob/8c5f077 > **agents**: [`Agent`](./agent)[] -Defined in: [src/weaveClient.ts:126](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L126) + *** @@ -23,4 +25,4 @@ Defined in: [src/weaveClient.ts:126](https://github.com/wandb/weave/blob/8c5f077 > `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 d1ae240047..b0bfcec83c 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentturnresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentturnresult.mdx @@ -3,8 +3,10 @@ title: "GetAgentTurnResult" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **GetAgentTurnResult** = [`AgentTurn`](./agentturn) -Result shape returned by [WeaveClient.getAgentTurn](../interfaces/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 8ca6e42177..e2c0443869 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentturnsresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentturnsresult.mdx @@ -3,11 +3,13 @@ title: "GetAgentTurnsResult" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **GetAgentTurnsResult** = `object` -Result shape returned by [WeaveClient.getAgentTurns](../interfaces/weaveclient#getagentturns). + -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](../interfaces/weaveclient#getagentturns). ## Properties @@ -15,7 +17,7 @@ Defined in: [src/weaveClient.ts:252](https://github.com/wandb/weave/blob/8c5f077 > **conversation\_id**: `string` -Defined in: [src/weaveClient.ts:253](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L253) + *** @@ -23,7 +25,7 @@ Defined in: [src/weaveClient.ts:253](https://github.com/wandb/weave/blob/8c5f077 > `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) + *** @@ -31,7 +33,7 @@ Defined in: [src/weaveClient.ts:259](https://github.com/wandb/weave/blob/8c5f077 > `optional` **has\_more**: `boolean` -Defined in: [src/weaveClient.ts:256](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L256) + *** @@ -39,7 +41,7 @@ Defined in: [src/weaveClient.ts:256](https://github.com/wandb/weave/blob/8c5f077 > `optional` **limit**: `number` -Defined in: [src/weaveClient.ts:257](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L257) + *** @@ -47,7 +49,7 @@ Defined in: [src/weaveClient.ts:257](https://github.com/wandb/weave/blob/8c5f077 > `optional` **offset**: `number` -Defined in: [src/weaveClient.ts:258](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L258) + *** @@ -55,7 +57,7 @@ Defined in: [src/weaveClient.ts:258](https://github.com/wandb/weave/blob/8c5f077 > `optional` **total\_turns**: `number` -Defined in: [src/weaveClient.ts:255](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L255) + *** @@ -63,4 +65,4 @@ Defined in: [src/weaveClient.ts:255](https://github.com/wandb/weave/blob/8c5f077 > `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 c4441b55b8..7446d8f8eb 100644 --- a/weave/reference/typescript-sdk/type-aliases/getagentversionsresult.mdx +++ b/weave/reference/typescript-sdk/type-aliases/getagentversionsresult.mdx @@ -3,11 +3,13 @@ title: "GetAgentVersionsResult" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **GetAgentVersionsResult** = `object` -Result shape returned by [WeaveClient.getAgentVersions](../interfaces/weaveclient#getagentversions). + -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](../interfaces/weaveclient#getagentversions). ## Properties @@ -15,7 +17,7 @@ Defined in: [src/weaveClient.ts:152](https://github.com/wandb/weave/blob/8c5f077 > `optional` **total\_count**: `number` -Defined in: [src/weaveClient.ts:154](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveClient.ts#L154) + *** @@ -23,4 +25,4 @@ Defined in: [src/weaveClient.ts:154](https://github.com/wandb/weave/blob/8c5f077 > **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/jsonobject.mdx b/weave/reference/typescript-sdk/type-aliases/jsonobject.mdx new file mode 100644 index 0000000000..4d4deec9e8 --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/jsonobject.mdx @@ -0,0 +1,16 @@ +--- +title: "JsonObject" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +> **JsonObject** = `object` + + + +An object whose properties are representable in JSON. + +## Index Signature + +\[`key`: `string`\]: [`JsonValue`](./jsonvalue) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/jsonvalue.mdx b/weave/reference/typescript-sdk/type-aliases/jsonvalue.mdx new file mode 100644 index 0000000000..00720972ce --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/jsonvalue.mdx @@ -0,0 +1,12 @@ +--- +title: "JsonValue" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +> **JsonValue** = `null` \| `boolean` \| `number` \| `string` \| readonly `JsonValue`[] \| [`JsonObject`](./jsonobject) + + + +A value representable in JSON. \ 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 46dc11c72d..2e5b980b8e 100644 --- a/weave/reference/typescript-sdk/type-aliases/messagepart.mdx +++ b/weave/reference/typescript-sdk/type-aliases/messagepart.mdx @@ -3,6 +3,8 @@ title: "MessagePart" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **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) + \ 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 b170a84047..4d9f13a07b 100644 --- a/weave/reference/typescript-sdk/type-aliases/modality.mdx +++ b/weave/reference/typescript-sdk/type-aliases/modality.mdx @@ -3,6 +3,8 @@ title: "Modality" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **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) + \ 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 ca3c238480..99189b523a 100644 --- a/weave/reference/typescript-sdk/type-aliases/op.mdx +++ b/weave/reference/typescript-sdk/type-aliases/op.mdx @@ -3,9 +3,11 @@ title: "Op" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **Op**\<`T`\> = `object` & `T` & (...`args`) => `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 Declaration @@ -23,7 +25,7 @@ Defined in: [src/opType.ts:7](https://github.com/wandb/weave/blob/8c5f077eb11c42 ### \_\_parameterNames -> `optional` **\_\_parameterNames**: `ParameterNamesOption` +> `optional` **\_\_parameterNames**: `"useParam0Object"` \| `string`[] ### \_\_savedRef @@ -39,6 +41,4 @@ Defined in: [src/opType.ts:7](https://github.com/wandb/weave/blob/8c5f077eb11c42 ## 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 63c3a7292c..c683def9fd 100644 --- a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx +++ b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx @@ -3,8 +3,12 @@ title: "OpDecorator" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **OpDecorator**\<`T`\> = (`value`, `context`) => `T` \| `void` & (`target`, `propertyKey`, `descriptor`) => `TypedPropertyDescriptor`\<`T`\> \| `void` + + Helper type for decorators This represents a decorator function that can be used with both legacy and Stage 3 decorators. @@ -17,10 +21,6 @@ For legacy decorators: propertyKey: The method name descriptor: The property descriptor containing the method -Defined in: [src/opType.ts:41](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/opType.ts#L41) - ## Type Parameters -### T - -`T` *extends* (...`args`) => `any` \ No newline at end of file + diff --git a/weave/reference/typescript-sdk/type-aliases/registercustomruntimeresult.mdx b/weave/reference/typescript-sdk/type-aliases/registercustomruntimeresult.mdx new file mode 100644 index 0000000000..bd887a0e39 --- /dev/null +++ b/weave/reference/typescript-sdk/type-aliases/registercustomruntimeresult.mdx @@ -0,0 +1,10 @@ +--- +title: "RegisterCustomRuntimeResult" +description: "TypeScript SDK reference" +--- + +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + +> **RegisterCustomRuntimeResult** = `CustomRuntimeApplyRes` + + \ 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 15153089bb..4124be807f 100644 --- a/weave/reference/typescript-sdk/type-aliases/response.mdx +++ b/weave/reference/typescript-sdk/type-aliases/response.mdx @@ -3,12 +3,12 @@ title: "Response" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **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 -### T - -`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 80d044d8dc..bf94abd942 100644 --- a/weave/reference/typescript-sdk/type-aliases/role.mdx +++ b/weave/reference/typescript-sdk/type-aliases/role.mdx @@ -3,8 +3,8 @@ title: "Role" description: "TypeScript SDK reference" --- -> **Role** = `"user"` \| `"assistant"` \| `"system"` \| `"tool"` \| `"developer"` \| `"function"` +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -Public data types for the Weave GenAI conversation SDK. +> **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) + \ 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 6f9a1fb9a0..42731564fb 100644 --- a/weave/reference/typescript-sdk/type-aliases/session.mdx +++ b/weave/reference/typescript-sdk/type-aliases/session.mdx @@ -8,6 +8,8 @@ description: "TypeScript SDK reference" **Deprecated.** Use [Conversation](../interfaces/conversation) instead. -> **Session** = *typeof* [`Conversation`](../interfaces/conversation) +import { SourceLink } from '/snippets/_includes/source-link.mdx'; -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 +> **Session** = [`Conversation`](../interfaces/conversation) + + \ 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 5e10b4aec1..0a6764a5d8 100644 --- a/weave/reference/typescript-sdk/type-aliases/sessioninit.mdx +++ b/weave/reference/typescript-sdk/type-aliases/sessioninit.mdx @@ -8,6 +8,8 @@ description: "TypeScript SDK reference" **Deprecated.** Use [ConversationInit](../interfaces/conversationinit) instead. +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **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) \ No newline at end of file + \ 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 6354c4a1e2..02e7c47cf0 100644 --- a/weave/reference/typescript-sdk/type-aliases/settings.mdx +++ b/weave/reference/typescript-sdk/type-aliases/settings.mdx @@ -3,9 +3,11 @@ title: "Settings" description: "TypeScript SDK reference" --- +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > **Settings** = `object` -Defined in: [src/settings.ts:3](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L3) + ## Properties @@ -13,9 +15,9 @@ Defined in: [src/settings.ts:3](https://github.com/wandb/weave/blob/8c5f077eb11c > `readonly` **attributes**: `Record`\<`string`, `any`\> -A map of attributes applied to every trace produced by this client. + -Defined in: [src/settings.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L14) +A map of attributes applied to every trace produced by this client. *** @@ -23,7 +25,7 @@ Defined in: [src/settings.ts:14](https://github.com/wandb/weave/blob/8c5f077eb11 > `readonly` **genai**: `object` -Defined in: [src/settings.ts:23](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L23) + #### batchOptions @@ -52,9 +54,24 @@ How GenAI spans are exported. > `readonly` **printCallLink**: `boolean` + + Prints links in terminal to Weave UI for ops. -Defined in: [src/settings.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/settings.ts#L9) +#### Default + +`true` + +*** + +### useCallsComplete + +> **useCallsComplete**: `boolean` + + + +Sends finished calls to the `calls/complete` endpoint (start+end paired +client-side) instead of the legacy `call/upsert_batch` path. #### Default @@ -66,9 +83,9 @@ Defined in: [src/settings.ts:9](https://github.com/wandb/weave/blob/8c5f077eb11c > **useOTelV2**: `boolean` -Routes OTel-capable integrations through their OTel variant. + -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 diff --git a/weave/reference/typescript-sdk/variables/endsession.mdx b/weave/reference/typescript-sdk/variables/endsession.mdx index 97b607da2e..9e33f9e482 100644 --- a/weave/reference/typescript-sdk/variables/endsession.mdx +++ b/weave/reference/typescript-sdk/variables/endsession.mdx @@ -8,17 +8,23 @@ description: "TypeScript SDK reference" **Deprecated.** Use [endConversation](../functions/endconversation) instead. +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > `const` **endSession**: (`opts?`) => `void` = `endConversation` -End the current Conversation. No-op if no Conversation is active. + -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 diff --git a/weave/reference/typescript-sdk/variables/getcurrentsession.mdx b/weave/reference/typescript-sdk/variables/getcurrentsession.mdx index c79635aed0..230db0f0d8 100644 --- a/weave/reference/typescript-sdk/variables/getcurrentsession.mdx +++ b/weave/reference/typescript-sdk/variables/getcurrentsession.mdx @@ -8,11 +8,13 @@ description: "TypeScript SDK reference" **Deprecated.** Use [getCurrentConversation](../functions/getcurrentconversation) instead. +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > `const` **getCurrentSession**: () => [`Conversation`](../interfaces/conversation) \| `undefined` = `getCurrentConversation` -Returns the current Conversation, or undefined. + -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 diff --git a/weave/reference/typescript-sdk/variables/startsession.mdx b/weave/reference/typescript-sdk/variables/startsession.mdx index 46e7af92ad..461ece9c9b 100644 --- a/weave/reference/typescript-sdk/variables/startsession.mdx +++ b/weave/reference/typescript-sdk/variables/startsession.mdx @@ -8,21 +8,23 @@ description: "TypeScript SDK reference" **Deprecated.** Use [startConversation](../functions/startconversation) instead. +import { SourceLink } from '/snippets/_includes/source-link.mdx'; + > `const` **startSession**: (`opts`) => [`Conversation`](../interfaces/conversation) = `startConversation` + + 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 +Pass `attributes` to propagate custom (non-semconv) attributes to every span the conversation emits. -Defined in: [src/genai/api.ts:33](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L33) - ## Parameters -### opts? - -[`ConversationInit`](../interfaces/conversationinit) = `{}` + + See [`ConversationInit`](../interfaces/conversationinit). + ## Returns