API Overview
Source
class FlushStatus
Status information about the current flush operation.
Source
class PendingJobCounts
Counts of pending jobs for each type.
Source
class WeaveClient
Source
method __init__
property num_outstanding_jobs
Returns the total number of pending jobs across all executors and the server. This property can be used to check the progress of background tasks without blocking the main thread. Returns:int: The total number of pending jobs
Source
method add_cost
llm_id: The ID of the LLM. eg “gpt-4o-mini-2024-07-18”prompt_token_cost: The cost per prompt token. eg .0005completion_token_cost: The cost per completion token. eg .0015effective_date: Defaults to the current date. A datetime.datetime object.provider_id: The provider of the LLM. Defaults to “default”. eg “openai”prompt_token_cost_unit: The unit of the cost for the prompt tokens. Defaults to “USD”. (Currently unused, will be used in the future to specify the currency type for the cost eg “tokens” or “time”)completion_token_cost_unit: The unit of the cost for the completion tokens. Defaults to “USD”. (Currently unused, will be used in the future to specify the currency type for the cost eg “tokens” or “time”) Returns: A CostCreateRes object. Which has one field called a list of tuples called ids. Each tuple contains the llm_id and the id of the created cost object.
Source
method clear_wandb_run_context
Source
method create_call
op: The operation producing the call, or the name of an anonymous operation.inputs: The inputs to the operation.parent: The parent call. If parent is not provided, the current run is used as the parent.display_name: The display name for the call. Defaults to None.attributes: The attributes for the call. Defaults to None.use_stack: Whether to push the call onto the runtime stack. Defaults to True. Returns: The created Call object.
Source
method delete_all_object_versions
object_name: The name of the object whose versions should be deleted. Returns: The number of versions deleted.
Source
method delete_all_op_versions
op_name: The name of the op whose versions should be deleted. Returns: The number of versions deleted.
Source
method delete_call
Source
method delete_calls
Source
method delete_object_version
Source
method delete_object_versions
-
call_ids: A list of call IDs to delete. Ex: [“2F0193e107-8fcf-7630-b576-977cc3062e2e”] Args: -
object_name: The name of the object whose versions should be deleted. -
digests: List of digests to delete. Can include aliases like “latest” or “v0”. Returns: The number of versions deleted.
Source
method delete_op_version
Source
method fail_call
Source
method finish
Source
method finish_call
call.summary are deep-merged with computed summary statistics (e.g. usage and status counts) before being written to the database.
Source
method flush
Source
method get
Source
method get_call
-
use_progress_bar: Whether to display a progress bar during flush. Set to False for environments where a progress bar would not render well (e.g., CI environments). -
callback: Optional callback function that receives status updates. Overrides use_progress_bar. Args: -
call_id: The ID of the call to get. -
include_costs: If true, cost info is included at summary.weave -
include_feedback: If true, feedback info is included at summary.weave.feedback -
columns: A list of columns to include in the response. If None, all columns are included. Specifying fewer columns may be more performant. Some columns are always included id, project_id, trace_id, op_name, started_at Returns: A call object.
Source
method get_calls
columns and use filter or query to reduce result size.
Args:
filter: High-level filter for narrowing results by fields likeop_name,parent_ids, etc.limit: Maximum number of calls to return.offset: Number of calls to skip before returning results (used for pagination).sort_by: List of fields to sort the results by (e.g.,started_at desc).query: A mongo-like expression for advanced filtering. Not all Mongo operators are supported.include_costs: If True, includes token/cost info insummary.weave.include_feedback: If True, includes feedback insummary.weave.feedback.include_storage_size: If True, includes the storage size for a call.include_total_storage_size: If True, includes the total storage size for a trace.columns: List of fields to return per call. Reducing this can significantly improve performance. (Some fields likeid,trace_id,op_name, andstarted_atare always included.)scored_by: Filter by one or more scorers (name or ref URI). Multiple scorers are AND-ed.page_size: Number of calls fetched per page. Tune this for performance in large queries.
CallsIter: An iterator overCallobjects. Supports slicing, iteration, and.to_pandas().
Source
method get_evaluation
weave:///entity/project/object/Evaluation:version
You can also get the evaluation by its “friendly” name: get_evaluation(“Evaluation:v1”)
Args:
uri(str): The unique resource identifier of the evaluation to retrieve.
Evaluation: The Evaluation object corresponding to the provided URI.
TypeError: If the object at the URI is not an Evaluation instance.ValueError: If the URI is invalid or the object cannot be found.
Source
method get_evaluations
list[Evaluation]: A list of all Evaluation objects in the current project. Empty list if no evaluations are found or if all conversions fail.
Source
method get_feedback
query: A mongo-style query expression. For convenience, also accepts a feedback UUID string.reaction: For convenience, filter by a particular reaction emoji.offset: The offset to start fetching feedback objects from.limit: The maximum number of feedback objects to fetch. Returns: A FeedbackQuery object.
Source
method purge_costs
Source
method query_costs
ids: The cost IDs to purge. Can be a single ID or a list of IDs. Examples:
query: A mongo-style query expression. For convenience, also accepts a cost UUID string.llm_ids: For convenience, filter for a set of llm_ids.offset: The offset to start fetching cost objects from.limit: The maximum number of cost objects to fetch. Returns: A CostQuery object.
Source
method save
val: The object to save.name: The name to save the object under.branch: The branch to save the object under. Defaults to “latest”. Returns: A deserialized version of the saved object.
Source
method set_wandb_run_context
run_id: The run ID (not including entity/project prefix). The client will automatically add the entity/project prefix.step: The step number to use for calls. If None, step will not be set. Examples:
Source
function get_obj_name
Source
function get_parallelism_settings
Source
function map_to_refs
Source
function print_call_link
Source
function redact_sensitive_keys
Source