目次
コンストラクタ
プロパティ
メソッド
- addScore
- createCall
- finishCall
- finishCallWithException
- get
- getAgentCustomAttributes
- getAgentSpanStats
- getAgentSpans
- getAgentTurn
- getAgentTurns
- getAgentVersions
- getAgents
- getCall
- getCallStack
- getCalls
- getCallsIterator
- getCurrentAttributes
- linkPromptToRegistry
- publish
- pushNewCall
- runWithAttributes
- runWithCallStack
- saveCallEnd
- saveCallStart
- saveOp
- searchAgents
- serializeAudio
- updateCall
- waitForBatchProcessing
コンストラクタ
コンストラクタ
«destructured»): WeaveClient
パラメーター
| 名 | タイプ |
|---|---|
«destructured» | Object |
› projectId | string |
› settings? | Partial<Settings> |
› traceServerApi | Api<any> |
戻り値
WeaveClient
定義箇所
プロパティ
projectId
string
定義箇所
settings
Settings
定義箇所
traceServerApi
Api<any>
定義箇所
メソッド
addScore
predictCallId, scorerCallId, runnableRefUri, scorerOutput): Promise<string>
call に scorer の結果 (例: scorer output) を追加します。
命令型評価で、predict call に scorer の結果を関連付けるために使用します。
パラメーター
| 名 | タイプ | 説明 |
|---|---|---|
predictCallId | string | フィードバックの関連付け先となる predict call のID |
scorerCallId | string | フィードバックを生成した scorer call のID |
runnableRefUri | string | scorer (Op または Object ref) のURI |
scorerOutput | any | scorerの出力 |
戻り値
Promise<string>
定義箇所
createCall
internalCall, opRef, params, parameterNames, thisArg, currentCall, parentCall, startTime, displayName?, attributes?): Promise<void>
パラメーター
| 名 | タイプ | |
|---|---|---|
internalCall | InternalCall | |
opRef | any | |
params | any[] | |
parameterNames | ParameterNamesOption | |
thisArg | any | |
currentCall | CallStackEntry | |
parentCall | undefined | CallStackEntry |
startTime | Date | |
displayName? | string | |
attributes? | Record<string, any> |
戻り値
Promise<void>
定義箇所
finishCall
call, result, currentCall, parentCall, summarize, endTime, startCallPromise): Promise<void>
パラメーター
| 名 | タイプ | |
|---|---|---|
call | InternalCall | |
result | any | |
currentCall | CallStackEntry | |
parentCall | undefined | CallStackEntry |
summarize | undefined | (result: any) => Record<string, any> |
endTime | Date | |
startCallPromise | Promise<void> |
戻り値
Promise<void>
定義箇所
finishCallWithException
call, error, currentCall, parentCall, endTime, startCallPromise): Promise<void>
パラメーター
| 名 | タイプ | |
|---|---|---|
call | InternalCall | |
error | any | |
currentCall | CallStackEntry | |
parentCall | undefined | CallStackEntry |
endTime | Date | |
startCallPromise | Promise<void> |
戻り値
Promise<void>
定義箇所
get
ref): Promise<any>
パラメーター
| 名 | タイプ |
|---|---|
ref | ObjectRef |
戻り値
Promise<any>
定義箇所
getAgentCustomAttributes
options): Promise<Response<GetAgentCustomAttributesResult>>
project 内のエージェントのスパンで観測された型付きカスタム属性キーを検出します。各結果行は 1 つの (source, key, value_type) トリプルに、その値を持つスパン数を加えたもので、spans の query/group/stats API がカスタム属性を参照する際に使用する形式です。
対象とするスパンは、query (構造化された span
フィルター) 、startedAfter / startedBefore (ISO-8601) 、またはその両方を指定して絞り込めます。検出されたキーをページングするには、
limit / offset を使用します。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentCustomAttributesOptions |
戻り値
Promise<Response<GetAgentCustomAttributesResult>>
例
定義箇所
getAgentSpanStats
options): Promise<Response<GetAgentSpanStatsResult>>
project 内のエージェント スパンに対する集約を、時系列 / バケット化された可視化に適した行 + 列の
メタデータとして返します。
start (必須) と end は時間ウィンドウを定義します。metrics の各エントリでは、
抽出するフィールドとその集約方法 (sum、
avg、count、パーセンタイルなど) を指定します。granularity (秒) を渡すと
行を時間単位でバケット化でき、groupBy を渡すと結果をエージェント /
provider / モデル / などごとに分けられます。query は、集約前に対象のスパンを
フィルターします。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentSpanStatsOptions |
戻り値
Promise<Response<GetAgentSpanStatsResult>>
例
定義箇所
getAgentSpans
options): Promise<Response<GetAgentSpansResult>>
エージェントのスパンをクエリします。必要に応じて、エージェント名や Mongo スタイルの
クエリ式でフィルターできます。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentSpansOptions |
戻り値
Promise<Response<GetAgentSpansResult>>
例
例
定義箇所
getAgentTurn
options): Promise<Response<AgentTraceChatRes>>
traceId で指定した単一のターンのデータ (メッセージを含む) を取得します。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentTurnOptions |
戻り値
Promise<Response<AgentTraceChatRes>>
例
定義箇所
getAgentTurns
options): Promise<Response<GetAgentTurnsResult>>
複数のターンのデータ (メッセージを含む) を conversationId ごとに取得します。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentTurnsOptions |
戻り値
Promise<Response<GetAgentTurnsResult>>
例
定義箇所
getAgentVersions
options): Promise<Response<GetAgentVersionsResult>>
指定したエージェントのバージョンを一覧で取得します。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentVersionsOptions |
戻り値
Promise<Response<GetAgentVersionsResult>>
例
定義箇所
getAgents
options?): Promise<Response<GetAgentsResult>>
集計済みの統計情報とともに、エージェントの一覧を返します。
パラメーター
| 名 | タイプ |
|---|---|
options | GetAgentsOptions |
戻り値
Promise<Response<GetAgentsResult>>
例
定義箇所
getCall
callId, includeCosts?): Promise<Call>
パラメーター
| 名 | タイプ | デフォルト値 |
|---|---|---|
callId | string | undefined |
includeCosts | boolean | false |
戻り値
Promise<Call>
定義箇所
getCallStack
CallStack
戻り値
CallStack
定義箇所
getCalls
options?): Promise<Call[]>
パラメーター
| 名 | タイプ |
|---|---|
options? | GetCallsOptions |
戻り値
Promise<Call[]>
定義箇所
options?, includeCosts?, limit?): Promise<Call[]>
パラメーター
| 名 | タイプ |
|---|---|
options? | CallsFilter |
includeCosts? | boolean |
limit? | number |
戻り値
Promise<Call[]>
定義箇所
getCallsIterator
options?, includeCosts?, limit?): AsyncIterableIterator<CallSchema, any, any>
パラメーター
| 名 | タイプ |
|---|---|
options? | CallsFilter |
includeCosts? | boolean |
limit? | number |
戻り値
AsyncIterableIterator<CallSchema, any, any>
定義箇所
options?): AsyncIterableIterator<CallSchema, any, any>
パラメーター
| 名 | タイプ |
|---|---|
options? | GetCallsOptions |
戻り値
AsyncIterableIterator<CallSchema, any, any>
定義箇所
getCurrentAttributes
Record<string, any>
戻り値
Record<string, any>
定義箇所
linkPromptToRegistry
prompt, options): Promise<LinkAssetToRegistryRes>
公開済みのプロンプト バージョンを Registry ポートフォリオにリンクします。
パラメーター
| 名 | タイプ |
|---|---|
prompt | RegistryLinkable |
options | LinkPromptToRegistryOptions |
戻り値
Promise<LinkAssetToRegistryRes>
定義箇所
publish
obj, objId?): Promise<ObjectRef>
パラメーター
| 名 | タイプ |
|---|---|
obj | any |
objId? | string |
戻り値
Promise<ObjectRef>
定義箇所
pushNewCall
Object
戻り値
Object
| 名 | タイプ |
|---|---|
currentCall | CallStackEntry |
newStack | CallStack |
parentCall? | CallStackEntry |
定義箇所
runWithAttributes
T>(attributes, fn): T
型パラメーター
| 名 |
|---|
T |
パラメーター
| 名 | タイプ |
|---|---|
attributes | Record<string, any> |
fn | () => T |
戻り値
T
定義箇所
runWithCallStack
T>(callStack, fn): T
型パラメーター
| 名 |
|---|
T |
パラメーター
| 名 | タイプ |
|---|---|
callStack | CallStack |
fn | () => T |
戻り値
T
定義箇所
saveCallEnd
callEnd): void
パラメーター
| 名 | タイプ |
|---|---|
callEnd | EndedCallSchemaForInsert |
戻り値
void
定義箇所
saveCallStart
callStart): void
パラメーター
| 名 | タイプ |
|---|---|
callStart | StartedCallSchemaForInsert |
戻り値
void
定義箇所
saveOp
op, objId?): Promise<OpRef>
パラメーター
| 名 | タイプ |
|---|---|
op | Op<(…args: any[]) => any> |
objId? | string |
戻り値
Promise<OpRef>
定義箇所
searchAgents
options): Promise<Response<SearchAgentsResult>>
project 内のエージェントメッセージ全体を対象に全文検索を実行します。結果は会話ごとに
グループ化され、一致した各メッセージのプレビューが表示されます。
query は全文検索の検索語です。空の文字列を渡すと、テキスト一致は行わず、
構造化フィルター (agentName,
conversationId, traceId) に一致するすべてのメッセージを取得できます。limit /
offset を使用して結果をページ単位で取得します。
パラメーター
| 名 | タイプ |
|---|---|
options | SearchAgentsOptions |
戻り値
Promise<Response<SearchAgentsResult>>
例
定義箇所
serializeAudio
data, audioType?): Promise<SerializedFileBlob>
生のオーディオバイトを Weave のコンテンツストアにアップロードし、
Call の出力に埋め込める CustomWeaveType プレースホルダーを返します。
これは、finishCall の自動シリアライズパイプラインを使用せずに、
Call の出力を手動で構築する場合 (たとえば saveCallEnd 経由) に使用します。
パラメーター
| 名 | タイプ | 既定値 | 説明 |
|---|---|---|---|
data | Buffer<ArrayBufferLike> | undefined | 生のオーディオバイト (ブラウザーとの互換性を最大限にするには WAV) |
audioType | "wav" | DEFAULT_AUDIO_TYPE | ファイル形式 — 現在サポートされているのは ‘wav’ のみです |
戻り値
Promise<SerializedFileBlob>
定義箇所
updateCall
callId, displayName): Promise<void>
パラメーター
| 名 | タイプ |
|---|---|
callId | string |
displayName | string |
戻り値
Promise<void>
定義箇所
waitForBatchProcessing
Promise<void>
戻り値
Promise<void>