This folder contains the backend code for the ORAssistant. Follow the instructions below to set up the environment and run the backend.
To configure the application, you'll need to set up the environment variables in your .env file:
The given command would copy the template for environment variables to a local .env file
cp .env.example .env
There are 2 variables that needs to be set up
GOOGLE_API_KEY
This key is used to access the various google cloud functions.
-
Go to Google Cloud Console
-
Create new project or select existing one
-
Enable required APIs:
- Google Gemini API
- Vertex AI API
-
Go to APIs & Services > Credentials
-
Click "Create Credentials" > "API Key"
-
Copy the generated key and it to the
.envfile -
GOOGLE_APPLICATION_CREDENTIALSSince most of the GCP functions / services would be used by our app, we need to have a special credential that would allowORAssistant's access to the GCP Steps to set up Service Account Credentials:- In Google Cloud Console, go to IAM & Admin > Service Accounts
- Click "Create Service Account" Fill in service account details
- Grant required roles:
- Vertex AI User
- Vertex AI Service Agent
- Create key (JSON format)
- Download JSON file
- Store securely and add path to .env:
GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
NOTE: The user might need billing to be set up on google cloud account and make sure to name the file as credentials.json as this would be ignored by .git and wouldn't be exposed on Github
ORAssistant supports running locally hosted Ollama models for inference. Follow these steps to set it up:
- Visit Ollama's installation page and follow the installation instructions for your system.
- In your
.envfile, set:LLM_MODEL="ollama" OLLAMA_MODEL="<model_name>"
Ensure Ollama is running locally before starting ORAssistant. Make sure the model weights are available by downloading them first with ollama pull <model_name>.
To take advantage of GPU resources when running ORAssistant in a Docker container, use ollama serve on local machine.
There are 4 variables that needs to be set up
-
LANGCHAIN_TRACING_V2This is used to enable LangChain's debugging and monitoring features, can be set to either
trueorfalse -
LANGCHAIN_ENDPOINTThe URL endpoint for LangSmith (LangChain's monitoring platform). Default value should be
https://api.smith.langchain.comfor cloud-hosted LangSmith. Used to send trace data, metrics, and debugging information from your LangChain applications. -
LANGCHAIN_API_KEYAPI key required to authenticate with LangSmith platform.
- Get your key from: https://smith.langchain.com/
- Create account if you don't have one
- Navigate to Settings > API Keys
- Create new API key
- Format: starts with
lsv2_followed by a unique string
-
LANGCHAIN_PROJECTProject identifier in LangSmith to organize and track your traces.
- Create new project in LangSmith dashboard
- Use the project name or ID provided
- Example: "my-rag-project"
- Helps organize different applications/environments
- Multiple apps can share same project
To set up the HF_TOKEN variable in .env file , go through the following instructions:
- Go the official website for Huggingface and either Login or Sign up.
- On the main page click on user access token
- Click on create access token
- Provide only Read Instruction for the token and Click on Generate Token
Provide the value for HF_TOKEN with the token that is generated
To use that chatbot in a text-based in your terminal, use the chatbot.py script:
uv run chatbot.pyInstall dependencies defined in pyproject.toml with:
uv syncIf you want to run an isolated container for backend, you can use the following command
docker build -t (image_name) .Make sure you are in the backend folder before running the above command.
NOTE: The project does support a docker-compose file that would run all of the containers together
OpenROAD's MCP server is a wrapper around the OpenROAD-flow-scripts. It utilizes the Streamable HTTP transport so it must be launched as a separate process. Run with python orfs_server.py
Currently tested with running python chatbot.py in another process.
Note: mcp breaks support for llms without toolchain i.e. json parsing