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

Bug: Weave predefined scorers fail for AsyncOpenAI clients #3051

Open
TeoZosa opened this issue Nov 22, 2024 · 3 comments
Open

Bug: Weave predefined scorers fail for AsyncOpenAI clients #3051

TeoZosa opened this issue Nov 22, 2024 · 3 comments

Comments

@TeoZosa
Copy link

TeoZosa commented Nov 22, 2024

Excited for the addition of new scoring functions, thanks for the hard work. With it being hot off the presses, I did run into this issue.

AsyncOpenAI clients seem to be supported:

_LLM_CLIENTS = Union[
OpenAI, AsyncOpenAI, Anthropic, AsyncAnthropic, Mistral, GenerativeModel
]

But the underlying calls for Weave scorers assume non-async clients:

def embed(
client: _LLM_CLIENTS, model_id: str, texts: str | list[str], **kwargs: Any
) -> list[list[float]]:
client_type = type(client).__name__.lower()
if "openai" in client_type:
response = client.embeddings.create(model=model_id, input=texts, **kwargs)
return [embedding.embedding for embedding in response.data]
elif "mistral" in client_type:
response = client.embeddings.create(model=model_id, inputs=texts, **kwargs)
return [embedding.embedding for embedding in response.data]
else:
raise ValueError(f"Unsupported client type: {type(client).__name__.lower()}")

@TeoZosa
Copy link
Author

TeoZosa commented Nov 23, 2024

Thanks @tcapelle for jumping on this so fast! 🙏

@TeoZosa
Copy link
Author

TeoZosa commented Jan 13, 2025

Hey @tcapelle, has this been deprioritized? We've been vendoring a fork of the code in our repos but this issue is blocking feature mainlining and broader release of some of our internal tools.

@tcapelle
Copy link
Contributor

Not at all, but we have a significant scorer overhaul incoming, that's why this change has not been integrated yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants