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

[OPIK-610] multi models support infrastructure #957

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

idoberko2
Copy link
Contributor

Details

This lays the ground for adding additional LLM provider integrations.

Issues

OPIK-610

@idoberko2 idoberko2 self-assigned this Dec 24, 2024
Copy link
Collaborator

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks in the good direction in my opinion.

I encourage to keep abstracting the minimum parts that differ per LLM provider, mostly the client instantiation, the calls (normal and streaming) and converting requests and responses from/to the OpenAI format.

Everything out of this, leave it in common classes/services, no need for interfacing them if not needed. This is to avoid unnecessary complexity.

@idoberko2 idoberko2 requested a review from andrescrz December 24, 2024 16:04
@amirzatcomet
Copy link

+1 to Andres's comment, there's still a lot that can be moved to a common ancestor class.

@idoberko2
Copy link
Contributor Author

Do you think it's still relevant to the latest version?

@idoberko2 idoberko2 force-pushed the ido/opik-610-support-anthropic-models branch from 8b7025b to 3bfb047 Compare December 25, 2024 07:18
throw llmProviderClient.mapRuntimeException(runtimeException);
if (llmProviderClient.getHttpExceptionClass().isInstance(runtimeException.getCause())) {
int statusCode = llmProviderClient.getHttpErrorStatusCode(runtimeException);
if (statusCode >= 400 && statusCode <= 499) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use the following code to check for response families instead of doing this yourself:
Response.Status.Family.familyOf(statusCode) == Response.Status.Family.CLIENT_ERROR)

works well for success response as well (I think I saw the same type of comparison for 200 somewhere in your code)

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

Successfully merging this pull request may close these issues.

3 participants