We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I want to use multiple sks and dynamically change sks, how should I write them because a single sk affects the rate?
The text was updated successfully, but these errors were encountered:
@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
setToken
openai-cpp/include/openai/openai.hpp
Line 97 in 61ad823
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.
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.
Sorry, something went wrong.
No branches or pull requests
If I want to use multiple sks and dynamically change sks, how should I write them because a single sk affects the rate?
The text was updated successfully, but these errors were encountered: