LangSmithEventHandler#
dbally.audit.LangSmithEventHandler
#
Bases: EventHandler[RunTree, RunTree]
This handler Logs events to a LangSmith instance.
Tip
To learn how to use LangSmithEventHandler
visit
How-To: Log db-ally runs to LangSmith
Constructs a new langsmith event handler instance.
PARAMETER | DESCRIPTION |
---|---|
api_key |
The api key for LangSmith. If None LANGCHAIN_API_KEY environment variable will be used.
TYPE:
|
Source code in src/dbally/audit/event_handlers/langsmith_event_handler.py
request_start
async
#
request_start(user_request: RequestStart) -> RunTree
Initializes the RunTree
object with all required attributes.
PARAMETER | DESCRIPTION |
---|---|
user_request |
The start of the request.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RunTree
|
run_tree object for a request span |
Source code in src/dbally/audit/event_handlers/langsmith_event_handler.py
event_start
async
#
event_start(event: Event, request_context: RunTree) -> RunTree
Log the start of the event.
PARAMETER | DESCRIPTION |
---|---|
event |
Event to be logged.
TYPE:
|
request_context |
Optional context passed from request_start method
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RunTree
|
run_tree object for an event span |
RAISES | DESCRIPTION |
---|---|
ValueError
|
when event is invalid |
Source code in src/dbally/audit/event_handlers/langsmith_event_handler.py
event_end
async
#
event_end(event: Optional[Event], request_context: RunTree, event_context: RunTree) -> None
Log the end of the event.
PARAMETER | DESCRIPTION |
---|---|
event |
Event to be logged.
TYPE:
|
request_context |
Optional context passed from request_start method
TYPE:
|
event_context |
Optional context passed from event_start method
TYPE:
|
Source code in src/dbally/audit/event_handlers/langsmith_event_handler.py
request_end
async
#
request_end(output: RequestEnd, request_context: RunTree) -> None
Log the end of the request.
PARAMETER | DESCRIPTION |
---|---|
output |
The output of the request. In this case - PSQL query.
TYPE:
|
request_context |
Optional context passed from request_start method
TYPE:
|