Boilerplate Python functions to make calls to Openai API chatcompletions
🕑 Added 2023-03-30 18:38:17 +0000 UTCgeneral_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
Comments
Echo Hive
I don't think I understand what you mean :( Did I have a post like that?
Mitchell
hi Echolive how can I access the BONUS : Cheat sheet
Echo Hive
Just updated this with token cost printing for the non beautified verison. it prints the cost based on model selection
Echo Hive
updated this with a new file addition, which does the same thing as the original file but renders beautified terminal chat,