Ryangr0 / GPT4-ExpertManager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPT4-ExpertManager

Prompt Library Manager

This library allows you to generate, store, and improve AI assistants (called "experts" in the code). The assistants are represented by the LanguageExpert class and can generate responses using either the OpenAI or Anthropic API.

Installation To install, clone this repo and install the requirements (Langchain, OpenAI, Anthropic)

You'll also need API keys for OpenAI and Anthropic, which should be stored in a config.py file like this:

OPENAI_API_KEY = "YOUR_KEY_HERE" 
ANTHROPIC_API_KEY = "YOUR_KEY_HERE"

Usage You can create a new Manager to store your experts:

manager = Manager() #Supply an existing library to load in existing experts.

Generate a new expert using the gen_prompt function:

expert = gen_prompt(manager) #Include prompt idea in ./promptpad.txt in same directory.

This will generate a prompt using the PromptGenerator and PromptIdeaGenerator experts, parse that into an expert, and add it to the manager.

You can then generate responses from the expert:

response = expert("Hello!")
print(response)
# Prints the expert's response to "Hello!"

Improve an existing expert with the improve function:

improved_expert = improve(expert, manager) 

This will use the PromptImprover and PromptSuggestionIncorporator to generate suggestions for improving the prompt, incorporate those into a new prompt, parse that into an expert, and return the new expert.

You can save all experts in the manager to a JSON file:

manager.save("experts.json")

And load experts from a JSON file into a manager:

manager.load("experts.json")

Let me know if you have any other questions!

About


Languages

Language:Python 100.0%