Open lzonel opened 1 year ago
@lzonel I suppose you are referring to secret keys as sks ?
If you are conformtable with C++, you can use the undocumented method setToken
on the session see https://github.com/olrea/openai-cpp/blob/61ad823ba3653d9751e1e5f60846af208858f69e/include/openai/openai.hpp#L97
I am willing to add more helpers and documentation if this something you might really need and you don't know how to proceed.
Check out https://github.com/olrea/openai-cpp#pass-by-reference
Pass by reference
An other approach is to pass the OpenAI instance by reference, store it, and call the appropriate methods when needed.
void bar(openai::OpenAI& openai) { openai.completion.create({ {"model", "text-davinci-003"}, {"prompt", "Say bar() function called"} }); } int main() { openai::OpenAI openai_instance{"your_api_key"}; bar(openai_instance); }
You can use a std::reference_wrapper as shown in examples/09-instances.cpp. This strategy is useful if you have to manage several OpenAI-CPP instances.
If I want to use multiple sks and dynamically change sks, how should I write them because a single sk affects the rate?