CoolFace
Apppublic

slandl/Agents_Course_Final_Assignment

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Running Locally

  1. 1.Install Poetry if you haven't already:
bash
   pip install poetry
  1. 1.Install dependencies:
bash
   poetry install
  1. 1.Authenticate with Hugging Face:
  2. 2.Option 1: Run poetry run huggingface-cli login
  3. 3.Option 2: Set the HF_TOKEN environment variable with your access token
  1. 1.Start the application:
bash
   python app.py

The app will be available at http://localhost:7860 by default.

LLM Backend Configuration

By default, the application uses a Hugging Face LLM backend. You can configure which backend to use with environment variables:

Hugging Face Backend (Default)

No additional configuration needed beyond the Hugging Face authentication mentioned above.

OpenAI Backend

To use OpenAI backend:

Set the environment variables:

bash
   export MODEL_TYPE=openai
   export OPENAI_MODEL=gpt-4o-mini  # or your preferred model
   export OPENAI_KEY=your_openai_api_key
   export OPENAI_TEMPERATURE=0.15

   # Optional: Rate limiting configuration
   export OPENAI_MAX_RETRIES=10      # Default: 10 (increased from LlamaIndex default of 3)
   export OPENAI_TIMEOUT=120.0       # Default: 120.0 seconds (increased from default 60.0)

Ollama Backend

To use an Ollama backend instead:

Set the environment variable:

bash
   export MODEL_TYPE=ollama
   export OLLAMA_MODEL=your_model_name
   export OLLAMA_TEMPERATURE=0.15
   export OLLAMA_CONTEXT_WINDOW=4000

Required Agent Capabilities

  • [x] Websearch
  • [x] Rate limit handling (OpenAI API with exponential backoff)
  • [x] Audio understanding/transcription
  • [x] Providing a concise answer
  • [ ] Web Video Viewing (Browser)
  • [x] Image understanding
  • [x] Attached file understanding (Excel)

Unset env vars

bash
unset MODEL_TYPE; unset HF_TOKEN; unset HF_MODEL; unset HF_TEMPERATURE; unset OLLAMA_MODEL; unset OLLAMA_TEMPERATURE; unset OLLAMA_CONTEXT_WINDOW; unset OPENAI_MODEL; unset OPENAI_KEY; unset OPENAI_TEMPERATURE; unset OPENAI_MAX_RETRIES; unset OPENAI_TIMEOUT