https://github.com/deepset-ai/haystack-rag-agent

https://github.com/deepset-ai/haystack-rag-agent

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.7%) to scientific vocabulary
Last synced: 5 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: deepset-ai
  • Language: Python
  • Default Branch: main
  • Size: 50.2 MB
Statistics
  • Stars: 2
  • Watchers: 0
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme

Readme.md

RagAgentExample.gif

Also works Async: AsyncRagExample.gif

Prerequisites

Before you begin, ensure you have the following:

  • Docker
  • Python 3.x
  • OpenAI API key

Setup Instructions

1. Add Your OpenAI API Key

A .env file already exists in the root directory of the project with the following content:

plaintext OPENAI_API_KEY=<your-api-key>

Replace <your-api-key> with your actual OpenAI API key. This key will be used by the application to interact with the OpenAI API.

2. Start the Docker Containers

To start the application, run the following command from the root directory:

bash docker compose up

This will start all the required Docker containers for the project.

3. Configure the Agent in OpenWebUI

The Agent does not support streaming out of the box, but OpenWebUI has Streaming set as a default. To configure the agent accordingly:

  1. Open the OpenWebUI interface in your browser at http://localhost:2000/.
  2. Follow the steps demonstrated in the video below to correctly configure the Agent, so that it Streaming is turned off and it therefore properly works in OpenWebUI:

tutorial.gif

Customizing the Agent's Tools

The tools.py file allows you to customize the tools the agent has access to. You can add new tools simply by creating a Python function with the appropriate annotations.

Example:

python def get_weather( city: Annotated[str, "The city for which to get the weather"] = "Munich", unit: Annotated[Literal["Celsius", "Fahrenheit"], "The unit for the temperature"] = "Celsius" ): """ A simple function to get the current weather for a location. """ return f"22.0 {unit}"

Adding a new tool like this enables the agent to perform additional tasks. You can refer to the other example methods already included in tools.py for further guidance.

Haystack Pipeline

The core logic of the Haystack pipeline, powering the agent, is implemented in agent.py. Below is a visualization of the pipeline:

pipeline.png

Owner

  • Name: deepset
  • Login: deepset-ai
  • Kind: organization
  • Email: hello@deepset.ai
  • Location: Berlin, Germany

Building enterprise search systems powered by latest NLP & open-source.

GitHub Events

Total
  • Watch event: 3
  • Member event: 1
  • Push event: 3
  • Fork event: 2
  • Create event: 2
Last Year
  • Watch event: 3
  • Member event: 1
  • Push event: 3
  • Fork event: 2
  • Create event: 2

Issues and Pull Requests

Last synced: 7 months ago


Dependencies

Dockerfile docker
  • deepset/haystack base-main build
docker-compose.yml docker
  • ghcr.io/open-webui/open-webui main
  • opensearchproject/opensearch latest