Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 1.43 KB

File metadata and controls

57 lines (37 loc) · 1.43 KB

Example agent that can handle PDF data with citations

This is an example agent, powered by OpenAI, that can perform question answering using data retrieved from widgets on OpenBB Workspace. It specifically demonstrates how to handle PDF data with citation support, including highlighting specific text passages.

Getting started

Here's how to get your agent up and running:

Prerequisites

Ensure you have poetry, a tool for dependency management and packaging in Python, as well as your OpenAI API key.

Installation and Running

  1. Clone this repository to your local machine.

  2. Set the OpenAI API key as an environment variable in your .bashrc or .zshrc file:

    # in .zshrc or .bashrc
    export OPENAI_API_KEY=<your-api-key>
  3. Install the necessary dependencies:

poetry install --no-root

4.Start the API server:

cd 36-vanilla-pdf-citations
poetry run uvicorn vanilla_agent_pdf_citations.main:app --port 7777 --reload

This command runs the FastAPI application, making it accessible on your network.

Testing the Agent

The example agent has a small, basic test suite to ensure it's working correctly. As you develop your agent, you are highly encouraged to expand these tests.

You can run the tests with:

pytest tests

Accessing the Documentation

Once the API server is running, you can view the documentation and interact with the API by visiting: http://localhost:7777/docs