Skip to main content

Agentic AI system for generating Bayesian optimization code from natural language using LangGraph and OpenAI GPT models

Project description

Honegumi RAG Assistant

An agentic workflow for Bayesian optimization code generation, built with LangGraph and powered by OpenAI models. Honegumi RAG Assistant codifies the end-to-end pipeline—parameter extraction, skeleton code generation, documentation retrieval, and code synthesis—into reusable nodes orchestrated as a LangGraph. LangSmith integration tracks and visualizes your graph executions. The result? Complete, ready-to-run Bayesian optimization code generated in seconds from natural language descriptions.


🚀 Why Honegumi RAG Assistant?

  • Agentic LangGraph design lets you describe problems in natural language and get production-ready code
  • Fast iteration: eliminate manual coding and focus on science
  • Built on Honegumi: Leverages deterministic skeleton generation from Honegumi
  • Intelligent RAG: Retrieves relevant Ax Platform documentation to enhance code generation
  • LangSmith-backed for graph tracking, versioning, and observability
  • Production-ready: versionable, testable, pip-installable

🛠️ Prerequisites


📘 Google Colab Tutorial

To help you get started quickly, we've prepared an interactive Google Colab tutorial:

Google Colab Tutorial: Getting Started with Honegumi RAG Assistant

In this tutorial, you'll learn how to:

  • Install Honegumi RAG Assistant and all necessary dependencies on Colab
  • Set up API keys using Colab Secrets
  • Build a vector store from Ax Platform documentation
  • Describe your optimization problem and generate code
  • View the generated code in your Google Drive

The tutorial runs entirely in Colab—no local setup required. All you need is access to your Google Drive and valid OpenAI/LangSmith API keys.


Installation via pip

  1. Create & activate a conda environment

    conda create -n honegumi_rag python=3.11 -y
    conda activate honegumi_rag
    
  2. Install via pip

    pip install honegumi-rag-assistant
    
  3. Configure your API keys

    Honegumi RAG Assistant will automatically look for a file named .env in your current working directory (or any parent) and load any keys it finds.

    In the folder where you'll run the CLI (or in any ancestor), create a file called .env containing:

    OPENAI_API_KEY=sk-...
    LANGCHAIN_API_KEY=lsv2_...
    
  4. Build vector store (one-time setup)

    For best results with documentation retrieval, build the vector store:

    # Download the build script
    wget https://raw.githubusercontent.com/hasan-sayeed/honegumi_rag_assistant/main/scripts/build_vector_store.py
    
    # Run it
    python build_vector_store.py --output ./ax_docs_vectorstore
    
    # Set the path in your .env
    echo "AX_DOCS_VECTORSTORE_PATH=./ax_docs_vectorstore" >> .env
    
  5. Run the assistant

    Now, start the honegumi-rag pipeline:

    honegumi-rag
    

    Honegumi RAG Assistant will:

    • Prompt you to describe your Bayesian optimization problem
    • Extract parameters (objectives, constraints, search space, etc.)
    • Generate a deterministic code skeleton using Honegumi
    • Retrieve relevant Ax Platform documentation
    • Generate complete, runnable Python code
    • Stream the code generation in real-time
    • Optionally save the generated code to a file

Usage Examples

Interactive Mode (Default)

honegumi-rag

You'll be prompted:

Please describe your Bayesian optimization problem.
(Press Enter when finished)

Your problem:

The assistant generates complete code and displays it in real-time.

Save Generated Code

honegumi-rag --output-dir ./my_experiments

Use Different Models

Customize which GPT models are used for each agent:

honegumi-rag \
  --code-writer-model gpt-5 \
  --param-selector-model gpt-4o \
  --retrieval-planner-model gpt-4o

Key Features

Multi-Agent Architecture

  • Parameter Selector: Extracts optimization parameters from natural language
  • Skeleton Generator: Uses Honegumi for deterministic code templates
  • Retrieval Planner: Generates intelligent documentation queries
  • Parallel Retrievers: Concurrent documentation retrieval for speed
  • Code Writer: GPT-5 powered code generation with streaming
  • Reviewer (optional): Quality assessment and refinement

Advanced Features

  • LangSmith Integration: Full tracing and debugging support
  • Streaming Output: See code generation in real-time
  • Flexible Models: Mix GPT-5 and GPT-4o for cost-performance optimization
  • Optional Save: Print code or save to file—your choice

Command Line Arguments

Argument Description Default
--output-dir Save generated script to specified directory (if omitted, code is only printed, not saved) None (no save)
--debug Enable debug mode with detailed logging False
--review Enable Reviewer agent (slower, more accurate) False
--param-selector-model Model for Parameter Selector gpt-5
--retrieval-planner-model Model for Retrieval Planner gpt-5
--code-writer-model Model for Code Writer agent gpt-5
--reviewer-model Model for Reviewer agent gpt-4o

Example Problems

Chemical Process Optimization

Optimize temperature (100-300°C), pressure (1-5 bar), and catalyst concentration (0.1-1.0 M) 
to maximize conversion rate in a catalytic reaction.

Materials Design

Optimize composition of a polymer blend: Component A (0-100%), Component B (0-100%), 
and curing temperature (80-150°C) to maximize tensile strength while minimizing cost.

Machine Learning Hyperparameters

Optimize neural network hyperparameters: learning rate (1e-5 to 1e-1), 
batch size (16 to 256), and dropout rate (0.1 to 0.5) to maximize validation accuracy.

Documentation & Support


Feedback & Feature Requests

This project demonstrates a proof of concept of what's possible with agentic systems for Bayesian optimization. While Honegumi RAG Assistant works out-of-the-box for many scenarios, your use case may involve more complex pipelines, custom constraints, or specific modeling needs.

Have something bigger in mind? Want Honegumi RAG Assistant to handle advanced features or integrate with your workflow?

We'd love to hear from you!


License

MIT License - see LICENSE.txt for details.


Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

honegumi_rag_assistant-0.1.5.tar.gz (683.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

honegumi_rag_assistant-0.1.5-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file honegumi_rag_assistant-0.1.5.tar.gz.

File metadata

  • Download URL: honegumi_rag_assistant-0.1.5.tar.gz
  • Upload date:
  • Size: 683.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for honegumi_rag_assistant-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5d5f5aa12fe2b3c474b5dfe1fbb1fc99a326273cbd426acae1c8f22e1c57d6ba
MD5 4343eebda0a6c900b3ecb47826a77f40
BLAKE2b-256 d15f299ef65b8e253deb2c9ff1cc888bc8b32eca10cb9a9722fe2119eeffc185

See more details on using hashes here.

File details

Details for the file honegumi_rag_assistant-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for honegumi_rag_assistant-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5e9e9d5c372523ec481d8c0d27d64c08b9fa6e1c8c4441604321f4c04aed1268
MD5 4b481e2124cdd4225579ee2386eff6c1
BLAKE2b-256 5b7e79fbf7d2afd5032513de3541bb305d4256cff2f88af4c009e68efbd6507f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page