Skip to content

Commit d8e2a50

Browse files
committed
fix: ci
1 parent d1fa606 commit d8e2a50

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

posthog/ai/langchain/callbacks.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,13 @@
99
from typing import Any, Optional, TypedDict, Union, cast
1010
from uuid import UUID
1111

12-
from langchain.callbacks.base import (
13-
BaseCallbackHandler,
14-
)
15-
from langchain_core.messages import (
16-
AIMessage,
17-
BaseMessage,
18-
FunctionMessage,
19-
HumanMessage,
20-
SystemMessage,
21-
ToolMessage,
22-
)
12+
from langchain.callbacks.base import BaseCallbackHandler
13+
from langchain_core.messages import AIMessage, BaseMessage, FunctionMessage, HumanMessage, SystemMessage, ToolMessage
2314
from langchain_core.outputs import ChatGeneration, LLMResult
24-
from posthog.client import Client
2515
from pydantic import BaseModel
2616

2717
from posthog.ai.utils import get_model_params
18+
from posthog.client import Client
2819

2920
PosthogProperties = dict[str, Any]
3021

posthog/test/ai/langchain/test_callbacks.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1+
import math
12
import os
23
import time
3-
import math
44
import uuid
55
from unittest.mock import patch
66

7+
import pytest
78
from langchain_community.chat_models.fake import FakeMessagesListChatModel
89
from langchain_community.llms.fake import FakeListLLM, FakeStreamingListLLM
910
from langchain_core.messages import AIMessage
1011
from langchain_core.prompts import ChatPromptTemplate
1112
from langchain_core.runnables import RunnableLambda
1213
from langchain_openai.chat_models import ChatOpenAI
13-
import pytest
1414

1515
from posthog.ai.langchain import PosthogCallbackHandler
1616

17-
1817
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
1918

2019

@@ -497,7 +496,6 @@ def test_openai_streaming(mock_client):
497496
api_key=OPENAI_API_KEY, model="gpt-4o-mini", temperature=0, max_tokens=1, stream=True, stream_usage=True
498497
)
499498
callbacks = PosthogCallbackHandler(mock_client)
500-
start_time = time.time()
501499
result = [m for m in chain.stream({}, config={"callbacks": [callbacks]})]
502500
result = sum(result[1:], result[0])
503501

@@ -530,7 +528,6 @@ async def test_async_openai_streaming(mock_client):
530528
api_key=OPENAI_API_KEY, model="gpt-4o-mini", temperature=0, max_tokens=1, stream=True, stream_usage=True
531529
)
532530
callbacks = PosthogCallbackHandler(mock_client)
533-
start_time = time.time()
534531
result = [m async for m in chain.astream({}, config={"callbacks": [callbacks]})]
535532
result = sum(result[1:], result[0])
536533

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,8 @@
8484
"Programming Language :: Python :: 3.6",
8585
"Programming Language :: Python :: 3.7",
8686
"Programming Language :: Python :: 3.8",
87+
"Programming Language :: Python :: 3.9",
88+
"Programming Language :: Python :: 3.10",
89+
"Programming Language :: Python :: 3.11",
8790
],
8891
)

0 commit comments

Comments
 (0)