Skip to content

Commit

Permalink
fix: fixed import in llm_openai.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Dec 3, 2024
1 parent 9ee19a0 commit 1647814
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions gptme/llm/llm_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@
if TYPE_CHECKING:
# noreorder
from openai import OpenAI # fmt: skip
from openai.types.chat import ( # fmt: skip
ChatCompletionToolParam,
)
from openai.types.chat.chat_completion_chunk import ( # fmt: skip
ChoiceDeltaToolCall,
ChoiceDeltaToolCallFunction,
)
from openai.types.chat import ChatCompletionToolParam # fmt: skip

openai: "OpenAI | None" = None
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -175,9 +169,13 @@ def stream(
openrouter_headers if "openrouter.ai" in str(openai.base_url) else {}
),
):
# Cast the chunk to the correct type
from openai.types.chat import ChatCompletionChunk # fmt: skip
from openai.types.chat.chat_completion_chunk import ( # fmt: skip
ChoiceDeltaToolCall,
ChoiceDeltaToolCallFunction,
)

# Cast the chunk to the correct type
chunk = cast(ChatCompletionChunk, chunk_raw)

if not chunk.choices:
Expand Down

0 comments on commit 1647814

Please sign in to comment.