Documentation Index
Fetch the complete documentation index at: https://wb-21fd5541-feature-automate-reference-docs-generation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
このモジュールは、Weaveトレースサーバーで使用されるスキーマとインターフェースを定義します。
CallSchema
WeaveにおけるCallオブジェクトのスキーマです。
class CallSchema:
id: str # Unique identifier for the call
project_id: Optional[str] # Associated project identifier
op_name: str # Name of the operation
display_name: Optional[str] # User-friendly display name
trace_id: str # Trace this call belongs to
parent_id: Optional[str] # Parent call ID (for nested calls)
started_at: datetime # When the call started
ended_at: Optional[datetime] # When the call ended
exception: Optional[str] # Exception message if failed
attributes: Dict[str, Any] # Custom attributes
inputs: Dict[str, Any] # Input parameters
output: Optional[Any] # Return value
summary: Optional[Dict[str, Any]] # Summary metrics
wb_user_id: Optional[str] # W&B user ID
wb_run_id: Optional[str] # W&B run ID
deleted_at: Optional[datetime] # Soft deletion timestamp
フィールドの説明
コアフィールド
- id:この呼び出しを一意に識別するUUID
- project_id:この呼び出しが属するW&Bプロジェクト(形式:「entity/project」)
- op_name:呼び出される操作の名前(参照可能)
- display_name:呼び出しのオプションの人間が読める名前
トレース階層
- trace_id:関連する呼び出しを単一のトレースにグループ化
- parent_id:子呼び出しを親にリンクし、ツリー構造を形成
タイミング
- started_at:実行が開始されたISO 8601タイムスタンプ
- ended_at:実行が完了したISO 8601タイムスタンプ
- deleted_at:設定されている場合、呼び出しがソフト削除されたことを示す
データ
- inputs:関数に渡された入力パラメータの辞書
- output:関数の戻り値(成功した場合)
- exception:呼び出しが失敗した場合のエラーメッセージ
- attributes:ユーザー定義のメタデータ(実行中は読み取り専用)
- summary:実行後のメトリクスと計算値
- wb_user_id:呼び出しを開始したW&Bユーザーへのリンク
- wb_run_id:実験追跡用のW&B実行へのリンク
CallsFilter
呼び出しを照会するためのフィルター条件。
class CallsFilter:
op_names: Optional[List[str]] # Filter by operation names
input_refs: Optional[List[str]] # Filter by input references
output_refs: Optional[List[str]] # Filter by output references
parent_ids: Optional[List[str]] # Filter by parent call IDs
trace_ids: Optional[List[str]] # Filter by trace IDs
call_ids: Optional[List[str]] # Filter by specific call IDs
trace_roots_only: Optional[bool] # Only return root calls
wb_user_ids: Optional[List[str]] # Filter by W&B user IDs
wb_run_ids: Optional[List[str]] # Filter by W&B run IDs
使用例
from weave import WeaveClient
client = WeaveClient("my-entity/my-project")
# Find all calls to a specific operation
filter = CallsFilter(
op_names=["process_document"],
trace_roots_only=True
)
calls = client.get_calls(filter=filter)
クエリ式
クエリ式を使用した高度なフィルタリング:
# Find calls with specific input values
calls = client.get_calls(
filter=CallsFilter(),
query={
"$expr": {
"$and": [
{"$eq": [{"$getField": "inputs.model"}, "gpt-4"]},
{"$gt": [{"$getField": "summary.total_tokens"}, 1000]}
]
}
}
)
計算フィールド
以下のフィールドはサーバーによって計算されます:
ステータス
以下の存在から導出されます:exceptionとended_at:
"running":呼び出しが開始されたが終了していない
"success":例外なしで呼び出しが終了
"error":例外で呼び出しが終了
以下の差として計算されます:ended_atとstarted_at(秒単位)。
コスト
コスト追跡呼び出しから集計されます。以下を含みます:
- トークン使用量
- APIコスト
- カスタムコストメトリクス
トレースサーバーインターフェースは柔軟で拡張可能に設計されています。カスタムフィールドはattributesやsummaryにスキーマ変更なしで追加できます。