Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removed use_async flag in cerebras client #1179

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
ivanleomk marked this conversation as resolved.
Show resolved Hide resolved
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
Loading
Loading