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.6.tar.gz (684.4 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.6-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: honegumi_rag_assistant-0.1.6.tar.gz
  • Upload date:
  • Size: 684.4 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.6.tar.gz
Algorithm Hash digest
SHA256 7ebfaa63bc8694e62413b7c75f4830603226dc151b5aca5d824d84ea175e65cf
MD5 086605a4b53543294075e53405fa7b78
BLAKE2b-256 15e0202894441029d57a8414c9f984cf28240ff8104fd98ca42cdb2674343c9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for honegumi_rag_assistant-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f7bd8115bbb5061aad06154630a4372260397d8d4a4c045ac3223a2b253a92f1
MD5 cb3e84483f29a89d8d9f6dfc3353f30c
BLAKE2b-256 768dfa5f1381a4fad69eba58a2e0efb5324fc88ecac067382c92a90546f003fb

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