|
4 | 4 | import os |
5 | 5 | import time |
6 | 6 | import uuid |
7 | | -from typing import List, Optional, TypedDict, Union, Literal |
| 7 | +from typing import List, Literal, Optional, TypedDict, Union |
8 | 8 | from unittest.mock import patch |
9 | 9 |
|
10 | 10 | import pytest |
11 | 11 | from langchain_anthropic.chat_models import ChatAnthropic |
12 | 12 | from langchain_community.chat_models.fake import FakeMessagesListChatModel |
13 | 13 | 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 |
15 | 15 | from langchain_core.prompts import ChatPromptTemplate |
16 | 16 | from langchain_core.runnables import RunnableLambda |
| 17 | +from langchain_core.tools import tool |
17 | 18 | from langchain_openai.chat_models import ChatOpenAI |
18 | 19 | from langgraph.graph.state import END, START, StateGraph |
19 | 20 | from langgraph.prebuilt import create_react_agent |
20 | | -from langchain_core.tools import tool |
21 | 21 |
|
22 | 22 | from posthog.ai.langchain import CallbackHandler |
23 | 23 | from posthog.ai.langchain.callbacks import GenerationMetadata, SpanMetadata |
@@ -1257,7 +1257,7 @@ def get_weather(city: Literal["nyc", "sf"]): |
1257 | 1257 | graph = create_react_agent(model, tools=tools) |
1258 | 1258 | inputs = {"messages": [("user", "what is the weather in sf")]} |
1259 | 1259 | 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]}) |
1261 | 1261 | calls = [call[1] for call in mock_client.capture.call_args_list] |
1262 | 1262 | assert len(calls) == 21 |
1263 | 1263 | for call in calls: |
|
0 commit comments