You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @sashirestela, first of all, thank you for this great library.
I'm experiencing a strange behavior regarding the OkHttpClientAdapter and custom interceptors. I am using simple-openai in a reactive environment (Apache Pekko/Akka) and I need to intercept the raw JSON responses to handle specific error codes (like insufficient_quota).
The Setup: I configure the client using a shared OkHttpClient with a network interceptor:
When calling openAI.embeddings().create(...), the interceptor works perfectly and I can see the logs in the console.
When calling openAI.chatCompletions().create(...), the interceptor is completely ignored. No logs are printed, and the request seems to bypass the OkHttp configuration or use a different internal client.
Observed Behavior: If a Chat call fails due to quota, I get a CleverClientException: Calling failed after 1 attempts, but my interceptor never catches the 429/402 response. However, if an Embedding call fails, the interceptor catches it correctly.
Question: Is the ChatCompletions interface instantiated differently or using a default HttpClient instead of the provided clientAdapter? How can I ensure the interceptor is applied to all interfaces?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @sashirestela, first of all, thank you for this great library.
I'm experiencing a strange behavior regarding the OkHttpClientAdapter and custom interceptors. I am using simple-openai in a reactive environment (Apache Pekko/Akka) and I need to intercept the raw JSON responses to handle specific error codes (like insufficient_quota).
The Setup: I configure the client using a shared OkHttpClient with a network interceptor:
When calling openAI.embeddings().create(...), the interceptor works perfectly and I can see the logs in the console.
When calling openAI.chatCompletions().create(...), the interceptor is completely ignored. No logs are printed, and the request seems to bypass the OkHttp configuration or use a different internal client.
Observed Behavior: If a Chat call fails due to quota, I get a CleverClientException: Calling failed after 1 attempts, but my interceptor never catches the 429/402 response. However, if an Embedding call fails, the interceptor catches it correctly.
Question: Is the ChatCompletions interface instantiated differently or using a default HttpClient instead of the provided clientAdapter? How can I ensure the interceptor is applied to all interfaces?
Beta Was this translation helpful? Give feedback.
All reactions