{"id":13455928,"url":"https://github.com/neuml/txtchat","last_synced_at":"2025-10-31T21:24:52.757Z","repository":{"id":65811962,"uuid":"600444021","full_name":"neuml/txtchat","owner":"neuml","description":"💭 Retrieval augmented generation (RAG) and language model powered search applications","archived":false,"fork":false,"pushed_at":"2024-01-16T12:48:45.000Z","size":4155,"stargazers_count":267,"open_issues_count":3,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-28T01:06:41.393Z","etag":null,"topics":["large-language-models","llm","machine-learning","nlp","python","rag","retrieval-augmented-generation","search","txtai"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neuml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-02-11T14:13:16.000Z","updated_at":"2024-09-23T20:02:16.000Z","dependencies_parsed_at":"2023-12-17T11:31:25.382Z","dependency_job_id":"ed85dec4-740d-4d64-95be-7f6ae68f583b","html_url":"https://github.com/neuml/txtchat","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"5e13416187ac2deda064b32faa88af45e367634f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Ftxtchat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Ftxtchat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Ftxtchat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Ftxtchat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neuml","download_url":"https://codeload.github.com/neuml/txtchat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221956015,"owners_count":16907476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["large-language-models","llm","machine-learning","nlp","python","rag","retrieval-augmented-generation","search","txtai"],"created_at":"2024-07-31T08:01:13.583Z","updated_at":"2025-10-31T21:24:52.750Z","avatar_url":"https://github.com/neuml.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/neuml/txtchat/master/logo.png\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eAutonomous agents - RAG - language model powered chat\u003c/b\u003e\n\u003c/p\u003e\n\n-------------------------------------------------------------------------------------------------------------------------------------------------------\n\ntxtchat builds autonomous agents, retrieval augmented generation (RAG) processes and language model powered chat applications.\n\n![demo](https://raw.githubusercontent.com/neuml/txtchat/master/demo.gif)\n\nThe advent of large language models (LLMs) has pushed a reimagination of search. LLM-powered search can do more. Instead of just bringing back results, search can now extract, summarize, translate and transform content into answers.\n\ntxtchat adds a set of intelligent agents that are available to integrate with messaging platforms. These agents or personas are associated with an automated account and respond to messages with AI-powered responses. Workflows can use large language models (LLMs), small models or both.\n\ntxtchat is built with Python 3.10+ and [txtai](https://github.com/neuml/txtai).\n\n## Installation\n\nThe easiest way to install is via pip and PyPI\n\n    pip install txtchat\n\nYou can also install txtchat directly from GitHub. Using a Python Virtual Environment is recommended.\n\n    pip install git+https://github.com/neuml/txtchat\n\nPython 3.10+ is supported\n\nSee [this link](https://github.com/neuml/txtai#installation) to help resolve environment-specific install issues.\n\n## Messaging platforms\n\ntxtchat is designed to support a number of messaging platforms. Currently, [Rocket.Chat](https://github.com/RocketChat/Rocket.Chat) is the only supported platform given it's ability to be installed in a local environment along with being MIT-licensed. The easiest way to start a local Rocket.Chat instance is with Docker Compose. See these [instructions](https://docs.rocket.chat/v1/docs/deploy-with-docker-docker-compose#step-1-install-docker-and-docker-compose) for more.\n\nExtending txtchat to additional platforms only needs a new Agent subclass for that platform.\n\n## Architecture\n\n![architecture](https://raw.githubusercontent.com/neuml/txtchat/master/images/architecture.png#gh-light-mode-only)\n![architecture](https://raw.githubusercontent.com/neuml/txtchat/master/images/architecture-dark.png#gh-dark-mode-only)\n\nA persona is a combination of a chat agent and workflow that determines the type of responses. Each agent is tied to an account in the messaging platform. Persona workflows are messaging-platform agnostic. The [txtchat-persona](https://hf.co/neuml/txtchat-personas) repository has a list of standard persona workflows.\n\n- [Agent](https://hf.co/neuml/txtchat-personas/blob/main/agent.yml): Agentic researcher with access to Wikipedia and web\n- [Wikitalk](https://hf.co/neuml/txtchat-personas/blob/main/wikitalk.yml): Retrieval Augmented Generation (RAG) with Wikipedia\n- [Summary](https://hf.co/neuml/txtchat-personas/blob/main/summary.yml): Reads input URLs and summarizes the text\n- [Mr. French](https://hf.co/neuml/txtchat-personas/blob/main/mrfrench.yml): Translates input text into French\n\nThe following command shows how to start a txtchat persona.\n\n```\n# Set to server URL, this is default when running local\nexport AGENT_URL=ws://localhost:3000/websocket\nexport AGENT_USERNAME=\u003cRocket Chat User\u003e\nexport AGENT_PASSWORD=\u003cRocket Chat User Password\u003e\n\n# YAML is loaded from Hugging Face Hub, can also reference local path\npython -m txtchat.agent wikitalk.yml\n```\n\nWant to add a new persona? Simply create a txtai workflow and save it to a YAML file.\n\n## Examples\n\nThe following is a [list of YouTube videos](https://www.youtube.com/watch?v=ROyess8dLoA\u0026list=PLaqn_lxC5d0C_HPe53GPk7jBH3xhBcgu-) that shows how txtchat works. These videos run a series of queries with the Wikitalk persona. Wikitalk is a combination of a [Wikipedia embeddings index](https://huggingface.co/NeuML/txtai-wikipedia) and a LLM prompt to answer questions.\n\nEvery answer shows an associated reference with where the data came from. Wikitalk will say \"I don't have data on that\" when it doesn't have an answer.\n\n### History\n\nConversation with Wikitalk about history.\n\n[![History](https://img.youtube.com/vi/ROyess8dLoA/maxresdefault.jpg)](https://youtube.com/watch?v=ROyess8dLoA)\n\n### Sports\n\nTalk about sports.\n\n[![Sports](https://img.youtube.com/vi/LXRB-iruKSc/maxresdefault.jpg)](https://youtube.com/watch?v=LXRB-iruKSc)\n\n### Culture\n\nArts and culture questions.\n\n[![Culture](https://img.youtube.com/vi/OkObkNhJIgk/maxresdefault.jpg)](https://youtube.com/watch?v=OkObkNhJIgk)\n\n### Science\n\nLet's quiz Wikitalk on science.\n\n[![Science](https://img.youtube.com/vi/-rsYDsZc9Wo/maxresdefault.jpg)](https://youtube.com/watch?v=-rsYDsZc9Wo)\n\n### Summary\n\nNot all workflows need a LLM. There are plenty of great small models available to perform a specific task. The Summary persona simply reads the input URL and summarizes the text.\n\n[![Summary](https://img.youtube.com/vi/PBJm9aDqkn0/maxresdefault.jpg)](https://youtube.com/watch?v=PBJm9aDqkn0)\n\n### Mr. French\n\nLike the summary persona, Mr. French is a simple persona that translates input text to French.\n\n[![French](https://img.youtube.com/vi/4x8pOIm4rbo/maxresdefault.jpg)](https://youtube.com/watch?v=4x8pOIm4rbo)\n\n## Connect your own data\n\nWant to connect txtchat to your own data? All that you need to do is create a txtai workflow. Let's run through an example of building a Hacker News indexing workflow and a txtchat persona.\n\nFirst, we'll define the indexing workflow and build the index. This is done with a workflow for convenience. Alternatively it could be a Python program that builds an embeddings index from your dataset. There are over [50 example notebooks](https://neuml.github.io/txtai/examples/) covering a wide range of ways to get data into txtai. There are also example workflows that can be downloaded from in this [Hugging Face Space](https://huggingface.co/spaces/NeuML/txtai).\n\n```yaml\npath: /tmp/hn\nembeddings:\n  path: sentence-transformers/all-MiniLM-L6-v2\n  content: true\ntabular:\n  idcolumn: url\n  textcolumns:\n  - title\nworkflow:\n  index:\n    tasks:\n    - batch: false\n      extract:\n      - hits\n      method: get\n      params:\n        tags: null\n      task: service\n      url: https://hn.algolia.com/api/v1/search?hitsPerPage=50\n    - action: tabular\n    - action: index\nwritable: true\n```\n\nThis workflow parses the Hacker News front page feed and builds an embeddings index at the path `/tmp/hn`. \n\nRun the workflow with the following.\n\n```python\nfrom txtai.app import Application\n\napp = Application(\"index.yml\")\nlist(app.workflow(\"index\", [\"front_page\"]))\n```\n\nNow we'll define the chat workflow and run it as an agent.\n\n```yaml\npath: /tmp/hn\nwritable: false\n\nrag:\n  path: Qwen/Qwen3-14B-AWQ\n  output: flatten\n  system: You are a friendly assistant. You answer questions from users.\n  template: |\n    Answer the following question using only the context below. Only include information\n    specifically discussed.\n\n    question: {question}\n    context: {context}\n\nworkflow:\n  search:\n    tasks:\n      - rag\n```\n\n```\npython -m txtchat.agent query.yml\n```\n\nLet's talk to Hacker News!\n\n![hn](https://raw.githubusercontent.com/neuml/txtchat/master/images/custom.png)\n\nAs you can see, Hacker News is a highly opinionated data source!\n\nGetting answers is nice but being able to have answers with where they came from is nicer. Let's build a workflow that adds a reference link to each answer.\n\n```yaml\npath: /tmp/hn\nwritable: false\n\nrag:\n  path: Qwen/Qwen3-14B-AWQ\n  output: reference\n  system: You are a friendly assistant. You answer questions from users.\n  template: |\n    Answer the following question using only the context below. Only include information\n    specifically discussed.\n\n    question: {question}\n    context: {context}\n\nworkflow:\n  search:\n    tasks:\n      - rag\n      - task: template\n        template: \"{answer}\\nReference: {reference}\"\n```\n\n![hn-reference](https://raw.githubusercontent.com/neuml/txtchat/master/images/custom-reference.png)\n\n## Further Reading\n\n- [Introducing txtchat — Retrieval Augmented Generation (RAG) powered search](https://medium.com/neuml/introducing-txtchat-next-generation-conversational-search-and-workflows-for-all-97557009fb53)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuml%2Ftxtchat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuml%2Ftxtchat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuml%2Ftxtchat/lists"}