LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_clienttypesthread_statsThreadStats
Class●Since v0.10

ThreadStats

Copy
ThreadStats()

Bases

BaseModel

Attributes

Inherited fromBaseModel

Attributes

Amodel_fields_set: set[str]Amodel_config: ConfigDictAmodel_construct: construct

Methods

Mto_dict
—
View source on GitHub
See More

Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Mto_json
—

Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation).

Mconstruct
Mmodel_dump
—

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump

Mmodel_dump_json
—

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json

Classes

CConfig
attribute
completion_cost: Optional[float]
attribute
completion_cost_details: Optional[CompletionCostDetails]
attribute
completion_token_details: Optional[CompletionTokenDetails]
attribute
completion_tokens: Optional[int]
attribute
feedback_stats: Optional[Dict[str, FeedbackStats]]
attribute
first_start_time: Optional[datetime]
attribute
last_end_time: Optional[datetime]
attribute
last_start_time: Optional[datetime]
attribute
latency_p50_seconds: Optional[float]
attribute
latency_p99_seconds: Optional[float]
attribute
prompt_cost: Optional[float]
attribute
prompt_cost_details: Optional[PromptCostDetails]
attribute
prompt_token_details: Optional[PromptTokenDetails]
attribute
prompt_tokens: Optional[int]
attribute
total_cost: Optional[float]
attribute
total_tokens: Optional[int]
attribute
turns: Optional[int]

completion_cost is the sum of per-trace completion costs across the thread, in USD. Populated when COMPLETION_COST is selected.

completion_cost_details is the per-sub-category sum of completion cost details across the thread. Populated when COMPLETION_COST_DETAILS is selected.

completion_token_details is the per-sub-category sum of completion token details across the thread. Populated when COMPLETION_TOKEN_DETAILS is selected.

completion_tokens is the sum of per-trace completion token counts across the thread. Populated when COMPLETION_TOKENS is selected.

feedback_stats aggregates run-level feedback across the thread's traces, keyed by feedback key. Populated when FEEDBACK_STATS is selected.

first_start_time is the earliest trace start time in the thread (RFC3339).

Populated when FIRST_START_TIME is selected.

last_end_time is the latest trace end time in the thread (RFC3339).

Populated when LAST_END_TIME is selected.

last_start_time is the latest trace start time in the thread (RFC3339).

Populated when LAST_START_TIME is selected.

latency_p50_seconds is the approximate p50 of trace latency across the thread, in seconds. Populated when LATENCY_P50 is selected.

latency_p99_seconds is the approximate p99 of trace latency across the thread, in seconds. Populated when LATENCY_P99 is selected.

prompt_cost is the sum of per-trace prompt costs across the thread, in USD.

Populated when PROMPT_COST is selected.

prompt_cost_details is the per-sub-category sum of prompt cost details across the thread. Populated when PROMPT_COST_DETAILS is selected.

prompt_token_details is the per-sub-category sum of prompt token details across the thread. Populated when PROMPT_TOKEN_DETAILS is selected.

prompt_tokens is the sum of per-trace prompt token counts across the thread.

Populated when PROMPT_TOKENS is selected.

total_cost is the sum of per-trace total costs across the thread, in USD.

Populated when TOTAL_COST is selected.

total_tokens is the sum of per-trace total token counts across the thread.

Populated when TOTAL_TOKENS is selected.

turns is the number of distinct traces (turns) in the thread.

Populated when TURNS is selected.