-
Notifications
You must be signed in to change notification settings - Fork 213
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
apps/opik-backend/src/main/java/com/comet/opik/domain/llmproviders/LlmProviderFactory.java
Outdated
Show resolved
Hide resolved
.../opik-backend/src/main/java/com/comet/opik/domain/llmproviders/LlmProviderStreamHandler.java
Outdated
Show resolved
Hide resolved
+1 to Andres's comment, there's still a lot that can be moved to a common ancestor class. |
Do you think it's still relevant to the latest version? |
8b7025b
to
3bfb047
Compare
apps/opik-backend/src/main/java/com/comet/opik/domain/llmproviders/LlmProviderFactory.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/llmproviders/OpenAi.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/llmproviders/OpenAi.java
Show resolved
Hide resolved
throw llmProviderClient.mapRuntimeException(runtimeException); | ||
if (llmProviderClient.getHttpExceptionClass().isInstance(runtimeException.getCause())) { | ||
int statusCode = llmProviderClient.getHttpErrorStatusCode(runtimeException); | ||
if (statusCode >= 400 && statusCode <= 499) { |
There was a problem hiding this comment.
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)
Details
This lays the ground for adding additional LLM provider integrations.
Issues
OPIK-610