/RAGAgent

REPL that uses RAG as it's context assembly

Primary LanguagePythonMIT LicenseMIT

โœจ Alas, brave adventurer! You've stumbled upon the grimoire of... โœจ

๐Ÿค– OTTO - Your Intelligent Conversational Companion ๐Ÿฆœ

๐Ÿš€ Embark on Your AI Quest! ๐Ÿš€

See the video! https://www.youtube.com/watch?v=YJAc-D-WXC4&t=191s

         ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ
       ๐Ÿ”ต        โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ          โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ       ๐Ÿ”ต 
       ๐ŸŸ         โ–ˆโ–ˆ    โ–ˆโ–ˆ          โ–ˆโ–ˆ    โ–ˆโ–ˆ       ๐ŸŸ   
       ๐ŸŸข        โ–ˆโ–ˆ  * โ–ˆโ–ˆ    TT    โ–ˆโ–ˆ *  โ–ˆโ–ˆ       ๐ŸŸข  
       ๐ŸŸฃ        โ–ˆโ–ˆ    โ–ˆโ–ˆ          โ–ˆโ–ˆ    โ–ˆโ–ˆ       ๐ŸŸฃ  
       ๐Ÿ”ด        โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ          โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ       ๐Ÿ”ด  
         ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ
         โค๏ธ               โค๏ธ    โค๏ธ              โค๏ธ                
          โค๏ธ    โค๏ธ                       โค๏ธ    โค๏ธ  
           โค๏ธ           โค๏ธ        โค๏ธ          โค๏ธ
            โค๏ธ               โค๏ธ             โค๏ธ  
              โค๏ธ                          โค๏ธ    
                โค๏ธ                      โค๏ธ      
                  โค๏ธโค๏ธโค๏ธโค๏ธโค๏ธโค๏ธโค๏ธโค๏ธโค๏ธโค๏ธ      
                  *~ *~ *~ *~ *~ *~ *~ *~
                      ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ
                      ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ

OTTO is a cutting-edge AI chat agent for macOS, now enhanced with the power of Fabric! Combining LangChain, Ollama, and Fabric's pattern-based approach, OTTO offers an immersive and intelligent conversational experience. Prepare to embark on an extraordinary adventure in artificial intelligence! ๐Ÿš€

Young apprentice wizards can find additional scrolls of maps, spells, and rituals in the chamber of documentation. After chanting the README, wise apprentices will find the chamber of documentation and chant the quickstart spells.

โœจ Features: A Treasure Trove of AI Wonders โœจ

๐Ÿง  Advanced Chat: Engage in thought-provoking conversations with OTTO, powered by Ollama and its Llama3 model.

๐ŸŽญ Fabric Patterns: Utilize a variety of pre-defined conversation patterns to guide and enhance your interactions.

๐Ÿ“œ Chat History: Relive past exchanges and track the twists and turns of your AI adventure.

๐ŸŽจ Colorful Console: A visually stunning interface enhances your journey with vibrant colors and readability.

๐Ÿ—ฃ๏ธ Text-to-Speech: Listen as OTTO's words come to life through the mystical powers of macOS's built-in 'say' command.

๐Ÿ“‹ Clipboard Conjuring: Copy interactions with ease and share your AI discoveries with the world.

๐Ÿ“Š Chat Insights: Delve into the statistics of your conversations and manage the annals of your AI history.

๐Ÿ” Web Quest (/search): Unleash the power of DuckDuckGo search directly within OTTO.

๐Ÿง  Memory Recall (/memory): OTTO remembers! Search past conversations using embeddings and RAG.

๐Ÿš€ Embark on Your AI Quest! ๐Ÿš€

  1. Gather Your Artifacts:

    • ๐Ÿ Python 3.8+ (The Serpent of Wisdom)
    • ๐Ÿง™โ€โ™‚๏ธ Ollama (The Enchanted Model Summoner)
    • ๐Ÿฆ™ gemma2 model (The Mystical Beast of Knowledge)
    • ๐Ÿงต Fabric (The Loom of Patterns)
  2. Installation Incantation:

    git clone https://github.com/MikeyBeez/RAGAgent.git
    cd RAGAgent
    conda create -n otto-env python=3.9
    conda activate otto-env
    pip install -r requirements.txt
    cp config_sample.py config.py
    python -m spacy download en_core_web_sm
    cd src
    cd ..
    python app.py
  3. Choose Your Path:

    • Select your adventurer name and your AI companion (from the available models).
    • Choose a Fabric pattern to guide your conversation.
  4. Command Your Quest:

    • ๐Ÿ’ฌ Type your messages naturally, as if speaking to a wise sage.
    • ๐Ÿ” Use magical slash commands to control your destiny:
      • /help: Reveal the ancient scrolls of available commands.
      • /chat <title>: Create a new chat with the given title.
      • /savechat: Preserve your current conversation for eternity.
      • /loadchat: Summon a past conversation from the archives.
      • /search <query>: Embark on a web search without leaving OTTO's presence.
      • /memory <query>, /m <query>: Journey through your past conversations to find relevant knowledge.
      • /fabric, /f: Choose a new Fabric pattern for your conversation.
      • /showpattern, /sp: Display the current Fabric pattern and its mystical content.

๐Ÿง™โ€โ™‚๏ธ Sharing Code with the AI Sage ๐Ÿง™โ€โ™‚๏ธ

To share your arcane code with OTTO, use this potent incantation in your terminal:

find . -type f -not \( -path "*/__pycache__/*" -o -path "./src/archive/*" -o -path "./src/experiments/*" -o -path "./src/tests/*" -o -name "*.db" -o -name "*.pyc" -o -name "*.json" -o -name "config*" -o -path "*/chats/*" -o -path "./memories/*" -o -name "*.log" -o -name "*pytest*" -o -path "*/.git/*" \) -exec sh -c 'if file -b --mime-type "$1" | grep -qE "^text/"; then echo "--- $1 ---"; cat "$1"; fi' _ {} \; | pbcopy

This mystical command will gather all relevant code files, ignoring those in the forbidden realms, and copy them to your clipboard. Paste the result into your chat with OTTO, and the AI sage shall parse your code with ease.

๐Ÿ† A Bard's Advice for a Successful Quest ๐Ÿ†

๐Ÿ’ก Experiment with different Fabric patterns to discover new depths in your conversations.

๐Ÿ”„ Use /truncate to keep your chat history manageable and ensure optimal performance.

๐Ÿ“‹ Quickly copy interactions to your clipboard with /copy.

๐Ÿ†˜ If you encounter any mystical anomalies, consult the scrolls within the chat_ollama.log or seek guidance from the Council of Elders (open an issue on GitHub).

๐Ÿ“œ Chat Persistence and Management OTTO provides a flexible chat management system that allows you to create, save, and load chats. However, it's important to understand how chat persistence works to ensure you don't lose your valuable conversations.

When you start a new chat using the /chat <title> command, the chat is created in memory but not automatically saved.

To persist a chat and ensure it's available for future sessions, you must explicitly save it using the /savechat command.

If you exit the app without saving the current chat, the chat will be lost and cannot be recovered.

To continue a previous conversation, use the /loadchat command to select and load a saved chat.

The /listchats command displays a list of all saved chats, allowing you to choose which one to load.

Remember to save your chats frequently to avoid losing your progress!

๐ŸŒŸ May Your Conversations Be Ever Insightful! ๐ŸŒŸ