Skip to content

TheBigBlockPC/openai_chatbots_module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openai_chatbots_module

a python module that makes creating chatbots easyer.

installation

  1. install the open ai package using
pip install openai
  1. copy the openAI_chatbots folder in to your project
  2. have fun with the module (:

demo

a demo of the module is included with this repo:demo

try this prompts:

read the file <filename><br>
write "<your text>" to the file <filename>

documantation

inital setup:

import openAI_chatbots as chat
chat.setApiKey("<your api key>")

creating a chatbot:

# Create a chatbot instance
# You can provide a system prompt and a prompt prefix if desired
# Optional: <system prompt>, <prompt prefix>
chatbot = chat.chatbot(system_prompt="<system prompt>", prompt_prefix="<prompt prefix>")

function calling:

creating a function calling object:

functions = chat.GPT_Functions.GPT_functions()

adding a function to the function calling object:

@functions.defineFunction("<description of your function>",
{
    "type":"string",
    "name":"<name of the parameter>",
    "description":"<description of the parameter>"
},...
)
def yourFunction(parameter1,...):
  return "<return value>"

binding the function calling object to a chatbot:

chatbot.setGptFunctions(functions)

chatting with the bot:

output = chatbot.chat("<prompt>")

generating output without prompt:

output = chatbot.generate()

About

a python module that makes creating chatbots easyer.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages