I was testing this lib, when I came across the error Unrecognized request argument supplied: api_key that ChatGPT than returned when execute the LLMChain.run
So I looked deeper into what the problem was and discovered that this line bellow:
def for_api(%ChatOpenAI{} = openai, messages, functions) do
%{
model: openai.model,
api_key: openai.api_key, # this line is not necessary, because this go into body request
temperature: openai.temperature,
frequency_penalty: openai.frequency_penalty,
n: openai.n,
stream: openai.stream,
messages: Enum.map(messages, &ForOpenAIApi.for_api/1),
response_format: set_response_format(openai)
}
|> Utils.conditionally_add_to_map(:seed, openai.seed)
|> Utils.conditionally_add_to_map(:functions, get_functions_for_api(functions))
end
When I removed the line api_key: openai.api_key the response is success from ChatGTP.
Hello guys!
I was testing this lib, when I came across the error
Unrecognized request argument supplied: api_key
that ChatGPT than returned when execute theLLMChain.run
So I looked deeper into what the problem was and discovered that this line bellow:
When I removed the line
api_key: openai.api_key
the response is success from ChatGTP.Error with api_key sended on body:
After fix this, API returns sucess!
Sorry if I'm wrong