Skip to content

RoBorregos/frida-cortex

Repository files navigation

HF Space

FRIDA Natural Language Command Interpreter

FRIDA is a natural language command interpreter for robotics that converts human instructions into structured robot actions. It uses LLM-powered parsing with BAML (boundaryml.com) to reliably interpret commands and generate executable task plans.

Springer LNAI Paper at MICAI 2025

DOI

Taming the LLM: Reliable Task Planning for Robotics Using Parsing and Grounding

architecture_600dpi

DOI: 10.1007/978-3-032-09037-9_24

Supplementary Material

Try It Online

Recommended: Use the πŸ€— Space for the easiest way to try FRIDA without any setup.

Alternatively, there's another Playground online.

Core Functionality

FRIDA interprets natural language commands and converts them into structured action sequences. For example:

Input: "Get a sponge from the pantry and deliver it to Jane in the living room"

Output:

{
  "commands": [
    {"action": "go_to", "location_to_go": "pantry"},
    {"action": "pick_object", "object_to_pick": "sponge"},
    {"action": "go_to", "location_to_go": "living room"},
    {"action": "find_person_by_name", "name": "Jane"},
    {"action": "give_object"}
  ]
}

Installation

Prerequisites

  • Python 3.8+
  • Docker (for local model inference)
  • Git (for submodules)

Setup

  1. Clone the repository with submodules:
git submodule update --init --recursive --remote
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up CommandGenerator (required for command generation):
cd dataset_generator/CommandGenerator
python -m venv venv
source venv/bin/activate
pip install .
athome-generator -d ../CompetitionTemplate
cd ../..
  1. Generate BAML client:
baml-cli generate --from command_interpreter/baml_src
  1. Configure environment (for API-based models):
cp .env.example .env
# Edit .env with your API keys

Usage

Command Line Interpreter

Run the interactive command interpreter:

python3 command_interpreter/interpreter.py

The interpreter supports:

  • Natural language command input
  • Model selection (press m)
  • Random command generation (press g)
  • Interactive execution of commands

Local Model Inference

FRIDA supports running a fine-tuned local model using Ollama. This allows you to use the system without API keys.

1. Download the Model

cd inference
./download-model.sh

This script:

  • Downloads the fine-tuned model from Hugging Face
  • Detects available Docker images
  • Creates the Ollama model configuration

2. Run the Inference Server

cd inference
./run-inference.sh

The script automatically:

  • Detects your hardware (NVIDIA GPU, Apple Silicon, CPU)
  • Configures Docker for optimal performance
  • Starts the Ollama service on http://localhost:11434

Platform-specific behavior:

  • macOS (Apple Silicon): Uses ARM64-optimized containers, CPU mode
  • macOS (Intel): Uses x86_64 containers with emulation, CPU mode
  • Linux (no GPU): CPU mode with host networking
  • Linux (NVIDIA GPU): GPU acceleration with host networking (requires NVIDIA Container Toolkit)
  • Windows: Standard port mapping, GPU support via Docker Desktop WSL2 backend

3. Use Local Model

Once the inference server is running, the LOCAL_FINETUNED model will be available in the command interpreter. The model is accessible at http://localhost:11434.

Alternative: Manual Docker Compose

For CPU-only mode using Docker Compose:

docker compose up

Web Application

The project includes a web interface for interacting with the command interpreter.

Quick Start

  1. Install web dependencies:
pip install -r app-requirements.txt
  1. Configure environment:
cp .env.example .env
# Add your GOOGLE_API_KEY to .env
  1. Run the Flask application:
python main.py
  1. Access the interface: Open http://localhost:8080 in your browser.

For a more advanced Next.js frontend with FastAPI backend, see the frontend/ and backend/ directories.

Dataset Generation

Generate training datasets for fine-tuning:

cd dataset_generator/
python3 structured_generator.py

The dataset will be generated in dataset_generator/dataset.json.

Project Structure

frida-cortex/
β”œβ”€β”€ command_interpreter/     # Core command interpretation logic
β”‚   β”œβ”€β”€ baml_src/           # BAML model definitions
β”‚   β”œβ”€β”€ interpreter.py      # Main CLI interpreter
β”‚   └── ...
β”œβ”€β”€ dataset_generator/       # Dataset generation tools
β”œβ”€β”€ fine_tuning/            # Model fine-tuning scripts
β”œβ”€β”€ inference/              # Local model inference setup
β”œβ”€β”€ backend/                # FastAPI backend service
β”œβ”€β”€ frontend/               # Next.js frontend application
└── main.py                 # Flask web application

Model Support

FRIDA supports multiple LLM providers:

  • Local Fine-tuned: LOCAL_FINETUNED (requires local inference server)
  • Google: GEMINI_PRO_2_5, GEMINI_FLASH_2_5
  • OpenAI: OPENAI_GPT_4_1_MINI
  • Anthropic: ANTHROPIC_CLAUDE_SONNET_4
  • Meta: META_LLAMA_3_3_8B_IT_FREE, META_LLAMA_3_3_70B

Documentation

License

See LICENSE file for details.

About

FRIDA natural language command interpreter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5