go-openai icon indicating copy to clipboard operation
go-openai copied to clipboard

Want to have field for adding headers in Client Config to support other open ai wrappers / analytics.

Open assembly-deepali opened this issue 1 year ago • 1 comments

Your issue may already be reported! Please search on the issue tracker before creating one.

Is your feature request related to a problem? Please describe. I'm trying to add an LLM Report to my current open ai calls. To do this, I want to be able to have an additional field as part of the ClientConfig to support modification of headers sent to openai.

This is their sample configuration (with node.js), where they've added a header to be able to support logging of all open ai calls made.

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY, 
  basePath: "https://api.openai.withlogging.com/v1",  
  baseOptions: { 
    headers: {
      "X-Api-Key": `Bearer ${process.env.LLM_REPORT_API_KEY}`, 
    },
  }
});

I don't see any option to add this right now in this package.

Describe the solution you'd like A clear and concise description of what you want to happen.

I want a way to add headers into the configuration or to the chat completion request call.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

assembly-deepali avatar Jan 04 '24 00:01 assembly-deepali

hi,is this problem solved?I also encounter the problem when I want to set a specific header name. I don't find any config to add user-defined header,Is there any way to solve this problem?

codeLief avatar Feb 05 '24 02:02 codeLief