Skip to main content

プロパティ

projectId

projectId: string

settings

settings: object

attributes

readonly attributes: Record<string, any>
このクライアントが生成するすべての trace に適用される属性のマップです。

genai

readonly genai: object
genai.batchOptions
optional batchOptions: BufferConfig
BatchSpanProcessor の設定です。spanProcessor === 'batch' の場合を除き、無視されます。
genai.spanProcessor
optional spanProcessor: "batch" | "simple" | SpanProcessor
GenAI のスパンをエクスポートする方法を指定します。
  • 'batch' (デフォルト) : BatchSpanProcessor。本番環境のエージェントや 長時間稼働するプロセスに適しています。
  • 'simple': SimpleSpanProcessor。スパンごとに HTTP POST を 1 回実行します。 スループットよりも確実な flush が重要となるテストや、短時間で終了する CLI に 適しています。
  • SpanProcessor インスタンス: ユーザーが指定するプロセッサです。ライフサイクルの管理は 呼び出し元の責任となり、/agents/otel/v1/traces を送信先とする Weave の OTLP エクスポーターは 使用されません。
readonly printCallLink: boolean
op の Weave UI へのリンクをターミナルに出力します。
デフォルト
true

useCallsComplete

useCallsComplete: boolean
完了した Call を、従来の call/upsert_batch パスではなく calls/complete エンドポイントに送信します (開始と終了はクライアント側でペアリングされます) 。
デフォルト
true

useOTelV2

useOTelV2: boolean
OTel に対応したインテグレーションを OTel バリアント経由でルーティングします。
デフォルト
true

traceServerApi

traceServerApi: Api<any>

メソッド

addScore()

addScore(predictCallId, scorerCallId, runnableRefUri, scorerOutput): Promise<string>
Scorer の結果 (Scorer の出力など) を Call に追加します。 命令型の評価で、Scorer の結果を予測 Call に関連付けるために使用します。

パラメーター

string
必須
feedback を関連付けるする predict call の ID
string
必須
feedback を生成した scorer call の ID
string
必須
scorer の URI (Op または Object ref)
any
必須
scorer の 出力

戻り値

Promise<string>

createCall()

createCall(internalCall, opRef, params, parameterNames, thisArg, currentCall, parentCall, startTime, displayName?, attributes?, eagerCallStart?): Promise<void>

パラメーター

InternalCall
必須
any
必須
any[]
必須
undefined | "useParam0Object" | string[]
必須
any
必須
object
必須
{…} | undefined
必須
完全なタイプ: { callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
Date
必須
string
Record<string, any>
boolean = false

戻り値

Promise<void>

finishCall()

finishCall(call, result, currentCall, parentCall, summarize, endTime, startCallPromise): Promise<void>

パラメーター

InternalCall
必須
any
必須
object
必須
{…} | undefined
必須
完全なタイプ: { callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
((result) => Record<string, any>) | undefined
必須
Date
必須
Promise<void>
必須

戻り値

Promise<void>

finishCallWithException()

finishCallWithException(call, error, currentCall, parentCall, endTime, startCallPromise): Promise<void>

パラメーター

InternalCall
必須
any
必須
object
必須
{…} | undefined
必須
完全なタイプ: { callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
Date
必須
Promise<void>
必須

戻り値

Promise<void>

flush()

flush(): Promise<void>
バッファされたすべての Call をサーバーに送信します。process.exit() の前に await してください。

戻り値

Promise<void>

get()

get(ref): Promise<any>

パラメーター

ObjectRef
必須
ObjectRef を参照してください。

戻り値

Promise<any>

getAgentCustomAttributes()

getAgentCustomAttributes(options): Promise<Response<{ attributes?: object[]; has_more?: boolean; limit?: number; offset?: number; }>>
project 内のエージェント スパンで検出された、型付きカスタム属性キーを取得します。各結果行は 1 つの (source, key, value_type) トリプルと、そのトリプルを持つスパン数で構成されます。スパンのクエリ、グループ化、統計 API では、この形式でカスタム属性を参照します。 query (構造化スパンフィルター) 、startedAfter / startedBefore (ISO-8601) 、または両方を指定して、対象のスパンをフィルターします。検出されたキーをページングするには、limit / offset を使用します。

パラメーター

object
必須

戻り値

Promise<Response<{ attributes?: object[]; has_more?: boolean; limit?: number; offset?: number; }>>


getAgents()

getAgents(options?): Promise<Response<GetAgentsResult>>
集計された統計情報を含むエージェントの一覧を取得します。

パラメーター

GetAgentsOptions = {}
GetAgentsOptions を参照してください。

戻り値

Promise<Response<GetAgentsResult>>


getAgentSpans()

getAgentSpans(options): Promise<Response<GetAgentSpansResult>>
エージェント スパンをクエリします。必要に応じて、エージェント名や Mongo スタイルのクエリ式でフィルターできます。

パラメーター

GetAgentSpansOptions
必須
GetAgentSpansOptions を参照してください。

戻り値

Promise<Response<GetAgentSpansResult>>


getAgentSpanStats()

getAgentSpanStats(options): Promise<Response<{ bucket_type?: "number" | "time"; columns?: object[]; end: string; granularity?: number | null; rows?: Record<string, string | number | boolean | null>[]; start: string; timezone: string; }>>
project 内のエージェント スパンに対する集約結果を、時系列または時間バケットの可視化に適した行と列のメタデータとして返します。 start (必須) とendで時間範囲を指定します。metricsの各エントリでは、抽出するフィールドと集約方法 (sumavgcount、パーセンタイルなど) を指定します。行を時間単位でバケット化するにはgranularity (秒) を指定し、エージェント/provider/モデルなどごとに結果を分けるにはgroupByを指定します。queryは、集約前に対象となるスパンをフィルターします。

パラメーター

object
必須

戻り値

Promise<Response<{ bucket_type?: "number" | "time"; columns?: object[]; end: string; granularity?: number | null; rows?: Record<string, string | number | boolean | null>[]; start: string; timezone: string; }>>


getAgentTurn()

getAgentTurn(options): Promise<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; }>>
traceId を指定して、単一の ターン のデータ (メッセージを含む) を取得します。

パラメーター

GetAgentTurnOptions
必須
GetAgentTurnOptions を参照してください。

戻り値

Promise<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; }>>


getAgentTurns()

getAgentTurns(options): Promise<Response<GetAgentTurnsResult>>
会話 ID を指定して、複数のターンのデータ (メッセージを含む) を取得します。

パラメーター

GetAgentTurnsOptions
必須
GetAgentTurnsOptions を参照してください。

戻り値

Promise<Response<GetAgentTurnsResult>>


getAgentVersions()

getAgentVersions(options): Promise<Response<GetAgentVersionsResult>>
指定したエージェントのバージョンを一覧表示します。

パラメーター

GetAgentVersionsOptions
必須
GetAgentVersionsOptions を参照してください。

戻り値

Promise<Response<GetAgentVersionsResult>>


getCall()

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>; }>

パラメーター

string
必須
boolean = false

戻り値

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>; }>

getCalls()

Call Signature

getCalls(options?): Promise<object[]>
パラメーター
GetCallsOptions
GetCallsOptions を参照してください。
戻り値
Promise<object[]>

Call Signature

getCalls(options?, includeCosts?, limit?): Promise<object[]>
パラメーター
CallsFilter
CallsFilter を参照してください。
boolean
number
戻り値
Promise<object[]>

getCallsIterator()

Call Signature

getCallsIterator(options?, includeCosts?, limit?): AsyncIterableIterator<CallSchema>
パラメーター
CallsFilter
CallsFilter を参照してください。
boolean
number
戻り値
AsyncIterableIterator<CallSchema>

Call Signature

getCallsIterator(options?): AsyncIterableIterator<CallSchema>
パラメーター
GetCallsOptions
GetCallsOptions を参照してください。
戻り値
AsyncIterableIterator<CallSchema>

getCallStack()

getCallStack(): CallStack

戻り値

CallStack

getCurrentAttributes()

getCurrentAttributes(): Record<string, any>

戻り値

Record<string, any>

linkPromptToRegistry()

linkPromptToRegistry(prompt, options): Promise<{ version_index: number | null; }>
公開済みの prompt バージョンを Registry ポートフォリオにリンクします。

パラメーター

string | ObjectRef | Prompt
必須
ObjectRef を参照してください。
object
必須

戻り値

Promise<{ version_index: number | null; }>

pendingCallCount()

pendingCallCount(): number
クライアント側でバッファされていて、まだサーバーに送信されていない Call の数です。

戻り値

number

publish()

publish(obj, objId?): Promise<ObjectRef>

パラメーター

any
必須
string

戻り値

Promise<ObjectRef>

pushNewCall()

pushNewCall(): object

戻り値

object
object
必須
currentCall.callId
callId: string
currentCall.childSummary
childSummary: Record<string, any>
currentCall.displayName
optional displayName: string
currentCall.opName
optional opName: string
currentCall.traceId
traceId: string
CallStack
必須
object
parentCall.callId
callId: string
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<{ api_key_secret: string | null; base_url: string; headers: Record<string, string>; name: string; runtime_ids: object[]; }>>
custom runtime を登録します。既に存在する場合は、その設定全体を置き換えます。

パラメーター

RegisterCustomRuntimeOptions
必須
RegisterCustomRuntimeOptions を参照してください。

戻り値

Promise<Response<{ api_key_secret: string | null; base_url: string; headers: Record<string, string>; name: string; runtime_ids: object[]; }>>

runWithAttributes()

runWithAttributes<T>(attributes, fn): T

タイプパラメーター

パラメーター

Record<string, any>
必須
() => T
必須

戻り値

T

runWithCallStack()

runWithCallStack<T>(callStack, fn): T

タイプパラメーター

パラメーター

CallStack
必須
() => T
必須

戻り値

T

saveCallEnd()

saveCallEnd(callEnd): void

パラメーター

object & object
必須

戻り値

void

saveCallStart()

saveCallStart(callStart, opts?): void

パラメーター

object
必須
object

戻り値

void

saveOp()

saveOp(op, objId?): Promise<OpRef>

パラメーター

Op<(...args) => any>
必須
Op を参照してください。
string

戻り値

Promise<OpRef>

searchAgents()

searchAgents(options): Promise<Response<{ results: object[]; total_conversations?: number; }>>
project 内のエージェントメッセージを全文検索します。一致したメッセージのプレビューを含む結果を、会話ごとにグループ化して返します。 query は全文検索の検索語です。空の文字列を渡すと、テキスト検索を行わずに構造化フィルター (agentNameconversationIdtraceId) に一致するすべてのメッセージを取得します。limit / offset を使用して結果をページネーションします。

パラメーター

object
必須

戻り値

Promise<Response<{ results: object[]; total_conversations?: number; }>>


serializeAudio()

serializeAudio(data, audioType?): Promise<{ _type: "CustomWeaveType"; files: Record<string, string>; load_op: string; weave_type: { type: string; }; }>
生のオーディオバイトを Weave コンテンツストアにアップロードし、Call の出力に埋め込み可能な CustomWeaveType プレースホルダーを返します。 finishCall の自動シリアル化パイプラインを使用せずに、saveCallEnd 経由などで Call の出力を手動で構築する場合に使用します。

パラメーター

Buffer
必須
生のオーディオバイト (ブラウザとの互換性を最大限確保するには WAV)
"wav" = DEFAULT_AUDIO_TYPE
ファイル形式 — 現在は ‘wav’ のみサポートされています

戻り値

Promise<{ _type: "CustomWeaveType"; files: Record<string, string>; load_op: string; weave_type: { type: string; }; }>

updateCall()

updateCall(callId, displayName): Promise<void>

パラメーター

string
必須
string
必須

戻り値

Promise<void>

waitForBatchProcessing()

waitForBatchProcessing(): Promise<void>

戻り値

Promise<void>