Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions posthog/ai/langchain/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ def _capture_trace_or_span(
"$ai_latency": run.latency,
"$ai_span_name": run.name,
"$ai_span_id": run_id,
"$ai_framework": "langchain",
}
if parent_run_id is not None:
event_properties["$ai_parent_id"] = parent_run_id
Expand Down Expand Up @@ -556,6 +557,7 @@ def _capture_generation(
"$ai_http_status": 200,
"$ai_latency": run.latency,
"$ai_base_url": run.base_url,
"$ai_framework": "langchain",
}

if run.tools:
Expand Down
1 change: 1 addition & 0 deletions posthog/test/ai/langchain/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def test_basic_chat_chain(mock_client, stream):
# Generation is second
assert generation_args["event"] == "$ai_generation"
assert "distinct_id" in generation_args
assert generation_props["$ai_framework"] == "langchain"
assert "$ai_model" in generation_props
assert "$ai_provider" in generation_props
assert generation_props["$ai_input"] == [
Expand Down
Loading