Skip to content

Commit fc2f96a

Browse files
committed
chore: bump and linters
1 parent 2be84c3 commit fc2f96a

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 3.10.0 - 2025-01-27
2+
3+
1. Add the `$ai_span` event to the LangChain callback handler to capture the input and output of intermediary chains.
4+
5+
## 3.9.3 - 2025-01-23
6+
7+
1. Fix capturing of multiple traces in the LangChain callback handler.
8+
19
## 3.9.2 - 2025-01-22
210

311
1. Fix importing of LangChain callback handler under certain circumstances.

posthog/ai/langchain/callbacks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
import time
88
import uuid
9+
from dataclasses import dataclass
910
from typing import (
1011
Any,
1112
Dict,
@@ -17,13 +18,12 @@
1718
cast,
1819
)
1920
from uuid import UUID
20-
from dataclasses import dataclass
2121

2222
from langchain.callbacks.base import BaseCallbackHandler
2323
from langchain.schema.agent import AgentAction, AgentFinish
24+
from langchain_core.documents import Document
2425
from langchain_core.messages import AIMessage, BaseMessage, FunctionMessage, HumanMessage, SystemMessage, ToolMessage
2526
from langchain_core.outputs import ChatGeneration, LLMResult
26-
from langchain_core.documents import Document
2727
from pydantic import BaseModel
2828

2929
from posthog import default_client

posthog/test/ai/langchain/test_callbacks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
import os
55
import time
66
import uuid
7-
from typing import List, Optional, TypedDict, Union, Literal
7+
from typing import List, Literal, Optional, TypedDict, Union
88
from unittest.mock import patch
99

1010
import pytest
1111
from langchain_anthropic.chat_models import ChatAnthropic
1212
from langchain_community.chat_models.fake import FakeMessagesListChatModel
1313
from langchain_community.llms.fake import FakeListLLM, FakeStreamingListLLM
14-
from langchain_core.messages import AIMessage, HumanMessage, ToolCall
14+
from langchain_core.messages import AIMessage, HumanMessage
1515
from langchain_core.prompts import ChatPromptTemplate
1616
from langchain_core.runnables import RunnableLambda
17+
from langchain_core.tools import tool
1718
from langchain_openai.chat_models import ChatOpenAI
1819
from langgraph.graph.state import END, START, StateGraph
1920
from langgraph.prebuilt import create_react_agent
20-
from langchain_core.tools import tool
2121

2222
from posthog.ai.langchain import CallbackHandler
2323
from posthog.ai.langchain.callbacks import GenerationMetadata, SpanMetadata
@@ -1257,7 +1257,7 @@ def get_weather(city: Literal["nyc", "sf"]):
12571257
graph = create_react_agent(model, tools=tools)
12581258
inputs = {"messages": [("user", "what is the weather in sf")]}
12591259
cb = CallbackHandler(mock_client, trace_id="test-trace-id", distinct_id="test-distinct-id")
1260-
res = graph.invoke(inputs, config={"callbacks": [cb]})
1260+
graph.invoke(inputs, config={"callbacks": [cb]})
12611261
calls = [call[1] for call in mock_client.capture.call_args_list]
12621262
assert len(calls) == 21
12631263
for call in calls:

posthog/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "3.9.3"
1+
VERSION = "3.10.0"
22

33
if __name__ == "__main__":
44
print(VERSION, end="") # noqa: T201

0 commit comments

Comments
 (0)