Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jan 18, 2025
1 parent cd77e2b commit 7ed13ce
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 44 deletions.
16 changes: 6 additions & 10 deletions docs/1-Getting started/3-Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@

We plan to build more examples but would love to see what you build with AGiXT. If you have an example you would like to share, please submit a pull request to add it to this page.

## Chatbot Example
## Expert Agent Example

Example of a basic AGiXT chatbot: Set your agent, make it learn whichever urls or files you want, then just keep using that conversation ID to keep a conversation going with the AI where it is aware of the history of your conversation (last 5 interactions). If you want to keep talking to it about the same docs without the history, start a new conversation and keep going with the same agent without any retraining of the documentation. Any conversations you have with the AI will be saved in the `agixt/conversations` directory and will also be viewable from inside of the AGiXT Streamlit Web UI.
Example of a basic AGiXT expert agent: Set your agent, make it learn whichever urls or files you want, then just keep using that conversation ID to keep a conversation going with the AI where it is aware of the history of your conversation (last 5 interactions). If you want to keep talking to it about the same docs without the history, start a new conversation and keep going with the same agent without any retraining of the documentation. Any conversations you have with the AI will be saved in the `agixt/conversations` directory and will also be viewable from inside of the AGiXT Streamlit Web UI.

You can open this file in a Jupyter Notebook and run the code cells to see the example in action. <https://github.com/Josh-XT/AGiXT/blob/main/examples/Chatbot.ipynb>
You can open this file in a Jupyter Notebook and run the code cells to see the example in action.

- [ezLocalai Example](https://github.com/Josh-XT/AGiXT/blob/main/examples/AGiXT-Expert-ezLocalai.ipynb)
- [OpenAI Example](https://github.com/Josh-XT/AGiXT/blob/main/examples/AGiXT-Expert-OAI.ipynb)

## Voice Chat Example

Example of a basic AGiXT voice chat: Make the agent listen to you saying a specific word that makes it take what you say, send it to the agent, and then execute an AGiXT function. In this example, you can use two different wake functions, `chat` and `instruct`. When this example is running, and you say each of the wake words, it will take the words you say after that, send them to the agent, and respond back to you with an audio response.

You can open this file in a Jupyter Notebook and run the code cells to see the example in action. <https://github.com/Josh-XT/AGiXT/blob/main/examples/Voice.ipynb>

## Some Examples of Useful Chains

- [Smart Chat](https://josh-xt.github.io/AGiXT/2-Concepts/Smart%20Chat.html)
- [Smart Instruct](https://josh-xt.github.io/AGiXT/2-Concepts/Smart%20Instruct.html)
- [Smart Task Chain](https://josh-xt.github.io/AGiXT/2-Concepts/Smart%20Task%20Chains.html)
- [Task Chain](https://josh-xt.github.io/AGiXT/2-Concepts/Task%20Chains.html)

## OpenAI Style Chat Completions Endpoint Example

See the details of this [pull request](https://github.com/Josh-XT/AGiXT/pull/1149) for example usage of the chat completions endpoint in AGiXT.
Expand Down
69 changes: 52 additions & 17 deletions examples/AGiXT-Expert-OAI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Train an Expert Agent in AGiXT with OpenAI Provider\n",
"# Train an Expert Agent in AGiXT\n",
"\n",
"This example assumes that you have your AGiXT server set up and running and that you have an OpenAI API Key to use for setting up this agent. You can use any other provider, but this example specifically uses OpenAI for the agent.\n",
"\n",
Expand All @@ -24,32 +24,67 @@
"from agixtsdk import AGiXTSDK\n",
"\n",
"agixt_server = \"http://localhost:7437\" # Change this to your AGiXT server URL\n",
"api_key = \"None\" # Change this to your AGiXT API key\n",
"\n",
"\n",
"api_key = \"None\" # Change this to your AGiXT API key (This should be your JWT in the web interface)\n",
"agixt = AGiXTSDK(base_uri=agixt_server, api_key=api_key)\n",
"\n",
"# If you dont have your jwt but have your authenticator:\n",
"# agixt = AGiXTSDK(base_uri=agixt_server)\n",
"# agixt.login(email=\"Your email address\", otp=\"123456\")\n",
"\n",
"agent_name = \"AGiXT\" # Change this if desired\n",
"\n",
"agixt.add_agent(\n",
" agent_name=agent_name,\n",
" settings={\n",
" \"provider\": \"openai\", # LLM Provider\n",
" \"transcription_provider\": \"default\", # Voice transcription provider, default uses the built in transcription in AGiXT.\n",
" \"translation_provider\": \"default\", # Voice translation provider, default uses the built in translation in AGiXT.\n",
" \"embeddings_provider\": \"default\", # Embeddings provider, default uses the built in embeddings in AGiXT.\n",
" \"image_provider\": \"None\", # If set, AGiXT will autonomously create images if it chooses to do so based on the conversation.\n",
" \"vision_provider\": \"openai\", # Vision provider, None means no vision capabilities. We will use OpenAI's since we're using GPT-4o.\n",
" \"tts_provider\": \"None\", # Change this to `default` or whichever TTS provider you want to use. None means no voice response.\n",
" \"AI_MODEL\": \"gpt-4o\", # GPT-4o is OpenAI's most capable model currently, we will use it for best results.\n",
" \"OPENAI_API_KEY\": \"YOUR_OPENAI_API_KEY\", # Get your OpenAI API key from https://platform.openai.com/account/api-keys\n",
" \"MAX_TOKENS\": 4096,\n",
" \"AI_TEMPERATURE\": \"0.7\",\n",
" \"AI_TOP_P\": \"0.95\",\n",
" \"mode\": \"prompt\", # For info about chat completion modes, go to https://josh-xt.github.io/AGiXT/2-Concepts/04-Chat%20Completions.html\n",
" \"prompt_name\": \"Chat\",\n",
" \"provider\": \"rotation\",\n",
" \"vision_provider\": \"rotation\",\n",
" \"tts_provider\": \"default\",\n",
" \"transcription_provider\": \"default\",\n",
" \"translation_provider\": \"default\",\n",
" \"embeddings_provider\": \"default\",\n",
" \"image_provider\": \"None\",\n",
" \"ANTHROPIC_API_KEY\": \"\",\n",
" \"ANTHROPIC_MODEL\": \"claude-3-5-sonnet-20241022\",\n",
" \"AZURE_MODEL\": \"\",\n",
" \"AZURE_API_KEY\": \"\",\n",
" \"AZURE_OPENAI_ENDPOINT\": \"\",\n",
" \"AZURE_DEPLOYMENT_NAME\": \"\",\n",
" \"AZURE_TEMPERATURE\": 0.7,\n",
" \"AZURE_TOP_P\": 0.95,\n",
" \"DEEPSEEK_API_KEY\": \"\",\n",
" \"DEEPSEEK_MODEL\": \"deepseek-chat\",\n",
" \"GOOGLE_API_KEY\": \"\",\n",
" \"GOOGLE_MODEL\": \"gemini-exp-1206\",\n",
" \"GOOGLE_TEMPERATURE\": 0.7,\n",
" \"GOOGLE_TOP_P\": 0.95,\n",
" \"EZLOCALAI_API_KEY\": \"\",\n",
" \"EZLOCALAI_API_URI\": \"\",\n",
" \"EZLOCALAI_VOICE\": \"DukeNukem\",\n",
" \"EZLOCALAI_TEMPERATURE\": 1.33,\n",
" \"EZLOCALAI_TOP_P\": 0.95,\n",
" \"OPENAI_API_KEY\": \"\", # Enter your OpenAI API key here\n",
" \"OPENAI_MODEL\": \"chatgpt-4o-latest\",\n",
" \"XAI_API_KEY\": \"\",\n",
" \"XAI_MODEL\": \"grok-beta\",\n",
" \"EZLOCALAI_MAX_TOKENS\": \"1\",\n",
" \"DEEPSEEK_MAX_TOKENS\": \"60000\",\n",
" \"AZURE_MAX_TOKENS\": \"100000\",\n",
" \"XAI_MAX_TOKENS\": \"120000\",\n",
" \"OPENAI_MAX_TOKENS\": \"128000\",\n",
" \"ANTHROPIC_MAX_TOKENS\": \"200000\",\n",
" \"GOOGLE_MAX_TOKENS\": \"2097152\",\n",
" \"SMARTEST_PROVIDER\": \"anthropic\",\n",
" \"mode\": \"prompt\",\n",
" \"prompt_name\": \"Think About It\",\n",
" \"prompt_category\": \"Default\",\n",
" \"analyze_user_input\": False,\n",
" \"websearch\": False,\n",
" \"websearch_depth\": 2,\n",
" \"WEBSEARCH_TIMEOUT\": 0,\n",
" \"persona\": \"AGiXT is an expert on the AGiXT AI agent automation platform and supports the users of AGiXT.\", # Use this field to set persona for the AI model\n",
" \"context_results\": 20, # How many memories from training to inject with each interaction.\n",
" \"tts\": False,\n",
" },\n",
")"
]
Expand Down
69 changes: 52 additions & 17 deletions examples/AGiXT-Expert-ezLocalai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,69 @@
"from agixtsdk import AGiXTSDK\n",
"\n",
"agixt_server = \"http://localhost:7437\" # Change this to your AGiXT server URL\n",
"api_key = \"None\" # Change this to your AGiXT API key\n",
"\n",
"\n",
"api_key = \"None\" # Change this to your AGiXT API key (This should be your JWT in the web interface)\n",
"agixt = AGiXTSDK(base_uri=agixt_server, api_key=api_key)\n",
"\n",
"# If you dont have your jwt but have your authenticator:\n",
"# agixt = AGiXTSDK(base_uri=agixt_server)\n",
"# agixt.login(email=\"Your email address\", otp=\"123456\")\n",
"\n",
"\n",
"agent_name = \"AGiXT\" # Change this if desired\n",
"\n",
"\n",
"agixt.add_agent(\n",
" agent_name=agent_name,\n",
" settings={\n",
" \"provider\": \"ezlocalai\", # LLM Provider\n",
" \"transcription_provider\": \"ezlocalai\", # Voice transcription provider, default uses the built in transcription in AGiXT.\n",
" \"translation_provider\": \"ezlocalai\", # Voice translation provider, default uses the built in translation in AGiXT.\n",
" \"embeddings_provider\": \"default\", # Embeddings provider, default uses the built in embeddings in AGiXT.\n",
" \"image_provider\": \"None\", # If set, AGiXT will autonomously create images if it chooses to do so based on the conversation.\n",
" \"vision_provider\": \"ezlocalai\", # Vision provider, None means no vision capabilities. We will use OpenAI's since we're using GPT-4o.\n",
" \"tts_provider\": \"ezlocalai\", # Change this to `default` or whichever TTS provider you want to use. None means no voice response.\n",
" \"VOICE\": \"Morgan_Freeman\", # Voice for TTS, change this to the voice you want to use from ezlocalai.\n",
" \"AI_MODEL\": \"ezlocalai\", # It doesn't matter which model you put here, ezlocalai uses the model it was started with.\n",
" \"provider\": \"rotation\",\n",
" \"vision_provider\": \"rotation\",\n",
" \"tts_provider\": \"ezlocalai\",\n",
" \"transcription_provider\": \"default\",\n",
" \"translation_provider\": \"default\",\n",
" \"embeddings_provider\": \"default\",\n",
" \"image_provider\": \"None\",\n",
" \"ANTHROPIC_API_KEY\": \"\",\n",
" \"ANTHROPIC_MODEL\": \"claude-3-5-sonnet-20241022\",\n",
" \"AZURE_MODEL\": \"\",\n",
" \"AZURE_API_KEY\": \"\",\n",
" \"AZURE_OPENAI_ENDPOINT\": \"\",\n",
" \"AZURE_DEPLOYMENT_NAME\": \"\",\n",
" \"AZURE_TEMPERATURE\": 0.7,\n",
" \"AZURE_TOP_P\": 0.95,\n",
" \"DEEPSEEK_API_KEY\": \"\",\n",
" \"DEEPSEEK_MODEL\": \"deepseek-chat\",\n",
" \"GOOGLE_API_KEY\": \"\",\n",
" \"GOOGLE_MODEL\": \"gemini-exp-1206\",\n",
" \"GOOGLE_TEMPERATURE\": 0.7,\n",
" \"GOOGLE_TOP_P\": 0.95,\n",
" \"EZLOCALAI_API_URI\": \"http://ezlocalai:8091/v1/\", # URL for the EZLOCALAI API, change this to your EZLOCALAI API URL. Never use localhost here, it is a different container.\n",
" \"EZLOCALAI_API_KEY\": \"Your EZLOCALAI API key\", # Change this to your EZLOCALAI API key\n",
" \"MAX_TOKENS\": 4096,\n",
" \"AI_TEMPERATURE\": \"0.7\",\n",
" \"AI_TOP_P\": \"0.95\",\n",
" \"mode\": \"prompt\", # For info about chat completion modes, go to https://josh-xt.github.io/AGiXT/2-Concepts/04-Chat%20Completions.html\n",
" \"prompt_name\": \"Chat\",\n",
" \"EZLOCALAI_VOICE\": \"DukeNukem\", # Voice for TTS, change this to the voice you want to use from ezlocalai.\n",
" \"EZLOCALAI_TEMPERATURE\": 1.33,\n",
" \"EZLOCALAI_TOP_P\": 0.95,\n",
" \"OPENAI_API_KEY\": \"\", # Enter your OpenAI API key here\n",
" \"OPENAI_MODEL\": \"chatgpt-4o-latest\",\n",
" \"XAI_API_KEY\": \"\",\n",
" \"XAI_MODEL\": \"grok-beta\",\n",
" \"EZLOCALAI_MAX_TOKENS\": \"1\",\n",
" \"DEEPSEEK_MAX_TOKENS\": \"60000\",\n",
" \"AZURE_MAX_TOKENS\": \"100000\",\n",
" \"XAI_MAX_TOKENS\": \"120000\",\n",
" \"OPENAI_MAX_TOKENS\": \"128000\",\n",
" \"ANTHROPIC_MAX_TOKENS\": \"200000\",\n",
" \"GOOGLE_MAX_TOKENS\": \"2097152\",\n",
" \"SMARTEST_PROVIDER\": \"anthropic\",\n",
" \"mode\": \"prompt\",\n",
" \"prompt_name\": \"Think About It\",\n",
" \"prompt_category\": \"Default\",\n",
" \"analyze_user_input\": False,\n",
" \"websearch\": False,\n",
" \"websearch_depth\": 2,\n",
" \"WEBSEARCH_TIMEOUT\": 0,\n",
" \"persona\": \"AGiXT is an expert on the AGiXT AI agent automation platform and supports the users of AGiXT.\", # Use this field to set persona for the AI model\n",
" \"context_results\": 20, # How many memories from training to inject with each interaction.\n",
" \"tts\": False,\n",
" },\n",
")"
]
Expand Down Expand Up @@ -171,7 +206,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.10.16"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 7ed13ce

Please sign in to comment.