Code Monkey home page Code Monkey logo

curiosity's Introduction

curiosity

Dabbling with ReAct chatbots

I started this toy project to dabble with LangGraph and FastHTML. My goal was to get some exposure to these tech stacks while trying to build a Perplexity-like user experience.

At the core is a simple ReAct Agent that uses Tavily search to augment the text generation. As in any good web project, most time was spend on making it look visually acceptable and sound from the interaction standpoint.

Curiosity

Using different LLMs

Three different LLMs are currently supported:

  • gpt-4o-mini by OpenAI
  • llama3-groq-8b-8192-tool-use-preview by Groq
  • llama3.1:latest by Ollama (run your own)

So far, OpenAI's gpt-4o-mini has been most robust. It showed a decent tool calling performance and generated meaningful responses. I had some initial issues with Groq, but that seemed to have been an issue with the API key. It seems that you need to have some patience until it is fully activated. Generation speed is excellent with Groq. However, the 8b llama3 is substantially fallling behind the gpt-4o answers. Using the local llama3.1 was just for fun. Running this on my Mac mini M1 brought the machine to its limits. But it is great to see the flexibility in swapping backends.

The Frontend

Building the web frontend with FastHTML was quite an experience. Given all the tech stacked into this framework it does feel fast at some time, but can also be a bit cumbersome to debug (e.g. issues with WebSockets closing for no reason). I also wanted to use WebSockets to stream token by token from the LLM to the frontend. But accessing the LLM tokens while keeping SQLite persistence for LangGraph was too deep of a rabbit hole for now.

Setup

  • Clone repository
  • Make sure to have a recent Python3 interpreter (required by fasthtml)
  • Setup venv and pip install -r requirements.txt
  • create an .env file and set the following variables:
# OpenAI - https://platform.openai.com/playground/chat
OPENAI_API_KEY=<key>
# Groq - https://console.groq.com
GROQ_API_KEY=<key>
# Tavily Search - https://app.tavily.com
TAVILY_API_KEY=<key>
# LangSmith - https://smith.langchain.com
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGSMITH_API_KEY=<key>
LANGCHAIN_PROJECT="Curiosity"
  • run python curiosity.py

curiosity's People

Contributors

jank avatar

Stargazers

Markus Rauhalahti avatar mono — Masayuki Ono avatar Alex Rigler avatar  avatar  avatar moo_hax avatar Code In Depth avatar Sven Sporer avatar  avatar  avatar David Khourshid avatar Niraj Fonseka avatar  avatar Atharva avatar Bora Alp Arat avatar Nate Ferrero avatar John avatar  avatar José Luis Di Biase avatar Alejandro Armas avatar Richard Watson avatar Nimit Agrawal avatar Harrison Chase avatar Brennon Williams avatar Ankur Shah avatar Sam avatar Sandalots avatar Skyler C avatar Richard Homewood avatar stvn shpd avatar  avatar Rahim Nathwani avatar Daren Race avatar R. Cooper Snyder avatar  avatar  avatar Ashmeet Sidhu avatar Stephen Strickland avatar Justin Hayes avatar Daniel Sczepansky avatar  avatar Ariel avatar Monami Sharma avatar Karl Horky avatar Tommy Bui Nguyen avatar Russell Dillin avatar Shankar Ambady avatar  avatar

Watchers

Richard Shea avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.