| title | CLAPP (qiskit ver.) | |
|---|---|---|
| emoji | 🚀 | |
| colorFrom | red | |
| colorTo | red | |
| sdk | docker | |
| app_port | 8501 | |
| tags |
|
|
| pinned | false | |
| short_description | qiskit LLM Agent for Pair Programming | |
| license | mit |
This project aims to design and evaluate multi-agent systems (MAS) that leverage Large Language Model (LLM) agents, enhanced with advanced prompt-engineering methods such as Retrieval-Augmented Generation (RAG), to improve quantum code generation. Standard LLMs are not trained on specialized scientific software and may hallucinate details, miss domain-specific context, or rely on outdated versions of libraries present in their training data. The envisioned tool would provide a conversational interface that fully understands the structure and features of the latest Qiskit releases, helping users with technical questions, code development and execution, debugging, and visualization.
qiskit LLM Agent is a Streamlit application that provides an AI pair programming assistant specialized in the qiskit quantum computing code. It uses LangChain and OpenAI models, leveraging Retrieval-Augmented Generation (RAG) with qiskit documentation and code examples to provide informed responses and assist with coding tasks.
- Daiki Murata
- Seemanta Bhattacharjee
- Francisco Villaescusa-Navarro
- Urbano L Franca
- inspired by the CLAPP
- Conversational AI: Interact with an AI assistant knowledgeable about qiskit.
- Code Execution: Executes Python code snippets in real-time, with automatic error detection and correction.
- RAG Integration: Retrieves relevant information from qiskit documentation and code (
./qiskit-data/) to answer questions accurately. - Multiple Response Modes:
- Fast Mode: Quick responses with good quality (recommended for most uses)
- Swarm Mode: Multi-agent refined responses for more complex questions (takes longer)
- Secure User Management: Username-based API key storage allows multiple users to securely save encrypted API keys.
- Real-time Feedback: Streams installation and execution progress in real-time.
- Model Selection: Choose between different OpenAI models (GPT-4o, GPT-4o-mini).
This project uses conda for environment management, which is compatible with qiskit installation requirements.
-
Clone the repository:
git clone https://github.com/daimurat/QAMP2025.git
-
Create a conda environment from the environment.yml file:
conda env create -f environment.yml
(Option) When you evaluate the agent by QiskitHumanEval, you need to another conda environment.
conda env create -f environment_eval.yml
-
Activate the environment:
conda activate streamapp
-
API Key:
- You will need an OpenAI API or Gemini key.
- The application allows you to enter a username, API key, and password to encrypt and store it locally.
- Keys are saved as
{username}_encrypted_api_keyto allow multiple users. - Get your free Gemini key from https://aistudio.google.com/app/apikey
-
environment variables file:
- You need to create a
.envfile in the root directory of the project.
OPENAI_API_KEY=<your-openai-api-key>
- You need to create a
-
qiskit Data:
- Ensure the
qiskit-datadirectory contains the necessary qiskit documentation for the RAG system.
- Ensure the
-
System Prompts:
- Ensure the
prompts/directory contains the necessary instruction files (qiskit_instructions.txt,review_instructions.txt, etc.).
- Ensure the
-
Activate the conda environment:
conda activate streamapp
-
Run the Streamlit application:
streamlit run CLAPP.py
-
Setup process:
- Enter your OpenAI API key and optionally a username and password for encryption.
- Initialize the application by clicking "Initialize with Selected Model".
- Start chatting with the assistant about qiskit-related questions.
-
Code execution:
- When the assistant provides code, you can execute it by typing "execute!" in the chat.
- The system will run the code, display the output, and show any generated plots.
- If errors occur, the system will automatically attempt to fix them.
-
Activate the conda environment:
conda activate qiskitagent
-
Run the evaluation script:
python evaluate_qiskit_humaneval.py --max-items 10 # or single-turn, no-RAG fast mode python evaluate_qiskit_humaneval.py --mode fast --no-rag --max-items 3Option Default Description --modelmeta-llama/llama-4-maverick-17b-128e-instruct(env:GROQ_EVAL_MODEL)model name --datasetQiskit/qiskit_humanevaldataset name --splittestdataset split --max-itemsNonemaximum items to evaluate --modedeepdeep(multi-agent) orfast(single-turn, no-RAG)--temperature0.2sampling temperature --max-output-tokens800maximum output tokens --timeout-sec45test execution timeout(sec) --use-rag/--no-ragTrueenable/disable RAG (ignored in fastmode)--rag-top-k5retrieval top_k --rag-min-score0.0minimum similarity score --db-pathQAMP/data/qamp.dbSQLite vector DB --task-idNonerun a specific task id --difficultyNonefilter by difficulty (basic/intermediate/difficult) --outdiroutoutput directory --dry-runFalseskip inference
CLAPP.py: The main Streamlit application script.environment.yml: Conda environment specification with all required dependencies.class-data/: Directory containing data for the RAG system (CLASS code, docs, etc.).prompts/: Directory containing system prompts for the AI agents.images/: Contains images used in the app interface, including the CLAPP logo.{username}_encrypted_api_key: Stores the encrypted OpenAI API keys for each user.