Boilerplate Python functions to make calls to Openai API chatcompletions (Patreon)
Published:
2023-03-30 18:38:17
Imported:
2023-06
Downloads
Content
general_gpt_call is a generalized function which takes in arguments for
- model type(gpt-3.5-turbo, gpt-4)
- count tokens or not
- keep history or not
- accepts **kwargs(key word arguments) for temperature, max_token count etc
Prints the response and the token count for each response plus the entire history plus the cost for token usage depending on the model selected
the other file is the same thing with beautiful terminal chat outputs using rich library
BONUS: Cheat sheet for Langchain:
https://github.com/Tor101/LangChain-CheatSheet