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
Is your feature request related to a problem? Please describe.
Very similar to #333
I'm using a proxy for requests to OpenAI and want to attach arbitrary dynamic metadata to each request as headers. This enables us to log extra information on who's sending the request through our services.
Basically - user sends request to internal service, service builds the prompt, adds their user id as header, and sends request to proxy using ruby-openai.
Current implementation only allows us to set a proxy on Client creation, but we cache it for multiple requests.
Describe the solution you'd like
Extra headers should be passed in with the rest of the request and merge into the extra_headers set in the Client.
@colinjc thanks for the request, I'd be open to a PR on this. Out of interest, what's the benefit of caching the client - have you measured any improvement in memory etc.?
Is your feature request related to a problem? Please describe.
Very similar to #333
I'm using a proxy for requests to OpenAI and want to attach arbitrary dynamic metadata to each request as headers. This enables us to log extra information on who's sending the request through our services.
Basically - user sends request to internal service, service builds the prompt, adds their user id as header, and sends request to proxy using
ruby-openai
.Current implementation only allows us to set a proxy on Client creation, but we cache it for multiple requests.
Describe the solution you'd like
Extra headers should be passed in with the rest of the request and merge into the extra_headers set in the Client.
Describe alternatives you've considered
Creating a client per request.
The text was updated successfully, but these errors were encountered: