Skip to content

Commit

Permalink
fix: removed use_async flag in cerebras client (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanleomk authored Nov 14, 2024
1 parent 78a1926 commit efabcf5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions instructor/client_cerebras.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, Literal, overload
from typing import Any, overload

import instructor
from instructor.client import AsyncInstructor, Instructor
Expand All @@ -13,7 +13,6 @@
def from_cerebras(
client: Cerebras,
mode: instructor.Mode = instructor.Mode.CEREBRAS_TOOLS,
use_async: Literal[False] = False,
**kwargs: Any,
) -> Instructor: ...

Expand All @@ -22,15 +21,13 @@ def from_cerebras(
def from_cerebras(
client: AsyncCerebras,
mode: instructor.Mode = instructor.Mode.CEREBRAS_TOOLS,
use_async: Literal[True] = True,
**kwargs: Any,
) -> AsyncInstructor: ...


def from_cerebras(
client: Cerebras | AsyncCerebras,
mode: instructor.Mode = instructor.Mode.CEREBRAS_TOOLS,
use_async: bool = False,
**kwargs: Any,
) -> Instructor | AsyncInstructor:
assert (
Expand All @@ -45,7 +42,7 @@ def from_cerebras(
client, (Cerebras, AsyncCerebras)
), "Client must be an instance of Cerebras or AsyncCerebras"

if use_async:
if isinstance(client, AsyncCerebras):
create = client.chat.completions.create
return AsyncInstructor(
client=client,
Expand Down

0 comments on commit efabcf5

Please sign in to comment.