プロパティ
projectId
projectId: string
settings
settings: object
attributes
このクライアントが生成するすべての trace に適用される属性のマップです。readonlyattributes:Record<string,any>
genai
readonlygenai:object
genai.batchOptions
optionalbatchOptions:BufferConfig
BatchSpanProcessor の設定です。spanProcessor === 'batch' の場合を除き、無視されます。
genai.spanProcessor
GenAI のスパンをエクスポートする方法を指定します。optionalspanProcessor:"batch"|"simple"|SpanProcessor
'batch'(デフォルト) :BatchSpanProcessor。本番環境のエージェントや 長時間稼働するプロセスに適しています。'simple':SimpleSpanProcessor。スパンごとに HTTP POST を 1 回実行します。 スループットよりも確実な flush が重要となるテストや、短時間で終了する CLI に 適しています。SpanProcessorインスタンス: ユーザーが指定するプロセッサです。ライフサイクルの管理は 呼び出し元の責任となり、/agents/otel/v1/tracesを送信先とする Weave の OTLP エクスポーターは 使用されません。
printCallLink
op の Weave UI へのリンクをターミナルに出力します。readonlyprintCallLink:boolean
デフォルト
true
useCallsComplete
useCallsComplete: boolean
完了した Call を、従来の call/upsert_batch パスではなく calls/complete エンドポイントに送信します (開始と終了はクライアント側でペアリングされます) 。
デフォルト
true
useOTelV2
useOTelV2: boolean
OTel に対応したインテグレーションを OTel バリアント経由でルーティングします。
デフォルト
true
traceServerApi
traceServerApi:Api<any>
メソッド
addScore()
addScore(Scorer の結果 (Scorer の出力など) を Call に追加します。 命令型の評価で、Scorer の結果を予測 Call に関連付けるために使用します。predictCallId,scorerCallId,runnableRefUri,scorerOutput):Promise<string>
パラメーター
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; } | undefinedDate
必須
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; } | undefinedDate
必須
Promise<void>
必須
戻り値
Promise<void>
flush()
flush():バッファされたすべての Call をサーバーに送信します。Promise<void>
process.exit() の前に await してください。
戻り値
Promise<void>
get()
get(ref):Promise<any>
パラメーター
戻り値
Promise<any>
getAgentCustomAttributes()
getAgentCustomAttributes(project 内のエージェント スパンで検出された、型付きカスタム属性キーを取得します。各結果行は 1 つのoptions):Promise<Response<{attributes?:object[];has_more?:boolean;limit?:number;offset?:number; }>>
(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(エージェント スパンをクエリします。必要に応じて、エージェント名や Mongo スタイルのクエリ式でフィルターできます。options):Promise<Response<GetAgentSpansResult>>
パラメーター
GetAgentSpansOptions
必須
GetAgentSpansOptions を参照してください。戻り値
Promise<Response<GetAgentSpansResult>>
例
getAgentSpanStats()
getAgentSpanStats(project 内のエージェント スパンに対する集約結果を、時系列または時間バケットの可視化に適した行と列のメタデータとして返します。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; }>>
start (必須) とendで時間範囲を指定します。metricsの各エントリでは、抽出するフィールドと集約方法 (sum、avg、count、パーセンタイルなど) を指定します。行を時間単位でバケット化するには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(traceId を指定して、単一の ターン のデータ (メッセージを含む) を取得します。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; }>>
パラメーター
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(会話 ID を指定して、複数のターンのデータ (メッセージを含む) を取得します。options):Promise<Response<GetAgentTurnsResult>>
パラメーター
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 バージョンを Registry ポートフォリオにリンクします。prompt,options):Promise<{version_index:number|null; }>
パラメーター
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
optionaldisplayName:string
currentCall.opName
optionalopName:string
currentCall.traceId
traceId: string
CallStack
必須
object
parentCall.callId
callId: string
parentCall.childSummary
childSummary:Record<string,any>
parentCall.displayName
optionaldisplayName:string
parentCall.opName
optionalopName:string
parentCall.traceId
traceId: string
registerCustomRuntime()
registerCustomRuntime(custom runtime を登録します。既に存在する場合は、その設定全体を置き換えます。options):Promise<Response<{api_key_secret:string|null;base_url:string;headers:Record<string,string>;name:string;runtime_ids:object[]; }>>
パラメーター
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>
パラメーター
string
戻り値
Promise<OpRef>
searchAgents()
searchAgents(project 内のエージェントメッセージを全文検索します。一致したメッセージのプレビューを含む結果を、会話ごとにグループ化して返します。options):Promise<Response<{results:object[];total_conversations?:number; }>>
query は全文検索の検索語です。空の文字列を渡すと、テキスト検索を行わずに構造化フィルター (agentName、conversationId、traceId) に一致するすべてのメッセージを取得します。limit / offset を使用して結果をページネーションします。
パラメーター
object
必須
戻り値
Promise<Response<{ results: object[]; total_conversations?: number; }>>
例
serializeAudio()
serializeAudio(生のオーディオバイトを Weave コンテンツストアにアップロードし、Call の出力に埋め込み可能なdata,audioType?):Promise<{_type:"CustomWeaveType";files:Record<string,string>;load_op:string;weave_type: {type:string; }; }>
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>