### Start Services with Docker Compose (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/VideoQnA/docker_compose/intel/cpu/xeon/README.md This snippet demonstrates how to start the GenAI examples project's services using Docker Compose. It first creates volumes, then starts the VDMS vector DB and dataprep, ingests sample data, and finally brings up the remaining services. It also accounts for the long model download time of the LVM server. ```bash cd GenAIExamples/VideoQnA/docker_compose/intel/cpu/xeon/ docker volume create video-llama- docker volume create videoqna-cache docker compose up vdms-vector-db dataprep -d sleep 30s # Insert some sample data to the DB curl -X POST ${DATAPREP_INGEST_SERVICE_ENDPOINT} \ -H "Content-Type: multipart/form-data" \ -F "files=@./data/op_1_0320241830.mp4" # Bring all the others docker compose up -d # wait until all the services is up. The LVM server will download models, so it take ~1.5hr to get ready. ``` -------------------------------- ### Cloning Repository and Setting Up Environment for DocSum on Gaudi (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/DocSum/docker_compose/intel/hpu/gaudi/README.md This snippet clones the GenAIExamples repository, navigates to the DocSum directory, sources the environment setup script for Intel Gaudi, and checks out a specific release version. It requires Git and a compatible shell environment; inputs are repository URL and version tag, outputs a prepared project directory. Limitations include needing prior Gaudi installation and potential port conflicts addressed in set_env.sh. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/DocSum/docker_compose source intel/hpu/gaudi/set_env.sh git checkout v1.3 ``` -------------------------------- ### Clone GenAIExamples Repository using Bash Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/hpu/gaudi/README.md This Bash script clones the OPEA GenAIExamples repository and navigates to the ChatQnA Docker Compose directory for Gaudi. It requires Git to be installed and internet access to GitHub. The output is the local repository setup, with no inputs beyond the commands. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/ChatQnA/docker_compose/intel/hpu/gaudi/ ``` -------------------------------- ### Build AudioQnA MegaService Docker Image Source: https://github.com/opea-project/genaiexamples/blob/main/AudioQnA/README_miscellaneous.md Builds the AudioQnA MegaService Docker image from the GenAIExamples repository. Requires Git and Docker to be installed. The build process uses proxy settings if configured. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/AudioQnA docker build --no-cache -t opea/audioqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . ``` -------------------------------- ### Setup GenAIExamples Repository - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/MultimodalQnA/docker_compose/amd/gpu/rocm/README.md Commands to clone the GenAIExamples repository and navigate to the MultimodalQnA directory, then checkout a specific released version (v1.3). Requires git to be installed and internet connectivity to access GitHub. This is the first step in the deployment process. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/MultimodalQnA ``` ```bash git checkout v1.3 ``` -------------------------------- ### Clone and Access GenAIExamples Repository using Bash Source: https://github.com/opea-project/genaiexamples/blob/main/AudioQnA/docker_compose/intel/cpu/xeon/README.md This bash script clones the GenAIExamples repository from GitHub and navigates to the AudioQnA directory. It requires git to be installed and internet access for cloning. The output is the local repository setup, with no specific limitations but depends on user permissions. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/AudioQnA ``` -------------------------------- ### Configure Deployment Environment using Bash Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/hpu/gaudi/README.md This Bash command sources a setup script to configure environment variables for ChatQnA services. It prompts for required and optional variables, generates a .env file, and requires the script to be in the current directory. Outputs include set environment variables and the .env file, with dependencies on the setup script. ```bash source ./set_env.sh ``` -------------------------------- ### Kubernetes Helm Deployment for ChatQnA Source: https://context7.com/opea-project/genaiexamples/llms.txt This section outlines deploying ChatQnA on Kubernetes using Helm charts. It includes adding the OPEA Helm repository, installing the chart with hardware-specific configurations (e.g., for Xeon), checking deployment status, viewing logs, scaling services, upgrading deployments, and uninstalling. ```bash helm repo add opea https://opea-project.github.io/GenAIInfra/ helm repo update export HUGGINGFACEHUB_API_TOKEN="your-hf-token" helm install chatqna-release opea/chatqna \ --namespace chatqna \ --create-namespace \ --set global.HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} \ --set global.modelUseHostPath=/models \ --set tgi.LLM_MODEL_ID=meta-llama/Meta-Llama-3-8B-Instruct \ --set tei.EMBEDDING_MODEL_ID=BAAI/bge-base-en-v1.5 \ --set teirerank.RERANK_MODEL_ID=BAAI/bge-reranker-base \ -f gaudi-values.yaml kubectl get pods -n chatqna kubectl get svc -n chatqna kubectl logs -n chatqna -l app.kubernetes.io/name=chatqna -f kubectl scale deployment chatqna-tgi -n chatqna --replicas=3 helm upgrade chatqna-release opea/chatqna \ --namespace chatqna \ --set tgi.replicaCount=2 \ --set retriever.replicaCount=3 helm uninstall chatqna-release -n chatqna kubectl delete namespace chatqna ``` -------------------------------- ### Clone and Access GenAIExamples Repository (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/SearchQnA/docker_compose/amd/gpu/rocm/README.md Clones the GenAIExamples repository from GitHub and navigates to the SearchQnA Docker Compose directory for AMD ROCm GPU setup. Requires Git installed. Outputs the project structure locally for further configuration. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/SearchQnA/docker_compose/amd/gpu/rocm ``` -------------------------------- ### Start Microservice Docker Containers Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/xeon/README_faqgen.md This command navigates to the specified directory and starts the microservices defined in the 'docker-compose.yaml' file in detached mode (`-d`). Ensure the environment variables are set before running this command. ```bash cd GenAIExamples/FaqGen/docker_compose/intel/cpu/xeon docker compose up -d ``` -------------------------------- ### Start Docker Containers Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/xeon/README_qdrant.md Command to start all services using Docker Compose. ```APIDOC ## Start all the services Docker Containers ### Description This command starts all the necessary Docker containers for the ChatQnA application using a docker-compose file. Ensure you are in the correct directory before executing. ### Command ```bash cd GenAIExamples/ChatQnA/docker_compose/intel/cpu/xeon/ docker compose -f compose_qdrant.yaml up -d ``` ``` -------------------------------- ### Start Docker Containers Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/xeon/README_mariadb.md Starts all necessary Docker containers for the GenAIExamples project using Docker Compose. Ensure you are in the correct directory containing the docker-compose.yaml file before execution. This command uses the 'up -d' flags to create and start containers in detached mode. ```bash cd GenAIExamples/ChatQnA/docker_compose/intel/cpu/xeon/ docker compose -f compose_mariadb.yaml up -d ``` -------------------------------- ### Start Docker Services Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/aipc/README.md Instructions to start all Docker containers using docker compose. ```APIDOC ## Start all the services Docker Containers ### Description Navigate to the directory containing the `docker-compose.yaml` file and start all services in detached mode. ### Command ```bash cd ~/OPEA/GenAIExamples/ChatQnA/docker_compose/intel/cpu/aipc/ docker compose up -d ``` ``` -------------------------------- ### Clone and Navigate to GenAIExamples Repository in Bash Source: https://github.com/opea-project/genaiexamples/blob/main/HybridRAG/docker_compose/intel/hpu/gaudi/README.md Clones the OPEA GenAIExamples repository from GitHub and changes to the HybridRAG docker compose directory for Intel Gaudi. Requires Git installed and internet access. Outputs cloned repository files; limited by network connectivity and repository permissions. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/HybridRAG/docker_compose/intel/hpu/gaudi/ ``` -------------------------------- ### Install Evaluation Dependencies Source: https://github.com/opea-project/genaiexamples/blob/main/CodeGen/benchmark/accuracy/README.md Installs required Python packages for running the evaluation harness. Supports both standard and Gaudi-specific setups. ```shell # pip install -r requirements-hpu.txt, if you deploy microservices on the Gaudi. pip install -r requirements.txt pip install -e . ``` -------------------------------- ### Setup GenAIEval Environment Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/benchmark/accuracy/README.md Clones the GenAIEval repository and installs its dependencies to prepare for accuracy evaluations. Requires a Python environment with pip installed. This sets up the necessary tools for running metrics on RAG pipelines. ```bash git clone https://github.com/opea-project/GenAIEval cd GenAIEval pip install -r requirements.txt pip install -e . ``` -------------------------------- ### Build AudioQnA UI Docker Image Source: https://github.com/opea-project/genaiexamples/blob/main/AudioQnA/README_miscellaneous.md Builds the AudioQnA frontend UI Docker image. Requires being in the GenAIExamples repository directory. The build process uses proxy settings if configured. ```bash cd GenAIExamples/AudioQnA/ui docker build -t opea/audioqna-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile . ``` -------------------------------- ### Get Pipeline JSON - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md Retrieves the JSON configuration of a specific pipeline by its name using a GET request to the /v1/settings/pipelines/{name}/json endpoint. The output is formatted using jq. ```bash curl -X GET http://${HOST_IP}:16010/v1/settings/pipelines/{name}/json -H "Content-Type: application/json" | jq '.' ``` -------------------------------- ### POST /start_profile Source: https://github.com/opea-project/genaiexamples/blob/main/AudioQnA/docker_compose/amd/cpu/epyc/README.md Starts performance profiling for vLLM backend service. Enables detailed performance analysis and metrics collection for the LLM service. ```APIDOC ## POST /start_profile ### Description Starts performance profiling for the vLLM backend service. Enables detailed performance analysis and metrics collection to monitor service performance and identify bottlenecks. ### Method POST ### Endpoint http://${host_ip}:${LLM_SERVER_PORT}/start_profile ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **model** (string) - Required - Model identifier for profiling ### Request Example ```bash curl http://${host_ip}:${LLM_SERVER_PORT}/start_profile \ -X POST \ -d '{"model": "meta-llama/Meta-Llama-3-8B-Instruct"}' \ -H 'Content-Type: application/json' ``` ### Response #### Success Response (200) - **status** (string) - Profiling status confirmation #### Response Example { "status": "profiling_started" } ``` -------------------------------- ### Docker Compose Deployment and Management Source: https://context7.com/opea-project/genaiexamples/llms.txt This section details how to deploy and manage the ChatQnA example using Docker Compose on Intel Xeon CPUs. It covers setting environment variables, starting/stopping services, checking status, viewing logs, and customizing deployments using environment files and scaling options. ```bash export HUGGINGFACEHUB_API_TOKEN="your-hf-token-here" export host_ip=$(hostname -I | awk '{print $1}') export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" export RERANK_MODEL_ID="BAAI/bge-reranker-base" export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct" cd ChatQnA/docker_compose/intel/cpu/xeon docker compose up -d docker compose ps docker compose logs -f chatqna-xeon-backend-server cat > .env << EOF EMBEDDING_MODEL_ID=BAAI/bge-large-en-v1.5 LLM_MODEL_ID=meta-llama/Meta-Llama-3-70B-Instruct CHATQNA_BACKEND_PORT=9000 EOF docker compose --env-file .env up -d docker compose up -d --scale retriever=3 docker compose down docker compose down -v ``` -------------------------------- ### Run Docker Compose for GraphRAG Services (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/GraphRAG/docker_compose/intel/cpu/xeon/README.md Starts GraphRAG microservices using Docker Compose with specified ports and configurations. Depends on Docker and pre-built images; optionally builds if not available. Inputs include directory path and port variables; outputs deployed services. Limitations include potential need for manual image builds and platform-specific setups like Xeon CPU. ```bash cd GraphRAG/docker_compose/intel/cpu/xeon NGINX_PORT=8080 docker compose -f compose.yaml up -d ``` -------------------------------- ### Test Final vLLM Source: https://github.com/opea-project/genaiexamples/blob/main/GraphRAG/docker_compose/intel/cpu/xeon/README.md An example curl command to test the vLLM service for chat completions. ```APIDOC ## Test Final vLLM ### Description This endpoint allows you to send a chat completion request to the vLLM service to test its functionality. Replace `${FINAL_LLM_MODEL_ID}` with your actual model ID. ### Method `POST` ### Endpoint `/v1/chat/completions` ### Request Body ```json { "model": "string", "messages": [ { "role": "string", "content": "string" } ] } ``` ### Request Example ```bash curl http://localhost:9009/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{"model":"'${FINAL_LLM_MODEL_ID}'","messages":[{"role":"user","content":"Tell me a joke?"}]}' ``` ``` -------------------------------- ### Check Deployment Status Source: https://github.com/opea-project/genaiexamples/blob/main/GraphRAG/docker_compose/intel/cpu/xeon/README.md Verify that all GraphRAG service containers have started correctly after running docker compose. ```APIDOC ## Check Deployment Status ### Description This command lists all running Docker containers, allowing you to verify that the GraphRAG services have been successfully launched and are in an 'Up' state. ### Command ```bash docker ps -a ``` ### Expected Output Example ``` CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 740d0061fce2 opea/nginx:latest "/docker-entrypoint.…" 3 hours ago Up 3 hours 0.0.0.0:8080->80/tcp, [::]:8080->80/tcp graphrag-xeon-nginx-server 3010243786cd opea/graphrag-ui:latest "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:5173->5173/tcp, :::5173->5173/tcp graphrag-ui-server f63d10453e22 opea/graphrag:latest "python graphrag.py" 3 hours ago Up 3 hours 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp graphrag-xeon-backend-server a48d0fba13e6 opea/dataprep:latest "sh -c 'python $( [ …" 3 hours ago Up 3 hours 0.0.0.0:6004->5000/tcp, [::]:6004->5000/tcp dataprep-neo4j-server 9301a833f220 opea/retriever:latest "python opea_retriev…" 3 hours ago Up 3 hours 0.0.0.0:7000->7000/tcp, :::7000->7000/tcp retriever-neo4j-server eda369268406 ghcr.io/huggingface/text-embeddings-inference:cpu-1.7 "text-embeddings-rou…" 3 hours ago Up 3 hours 0.0.0.0:6006->80/tcp, [::]:6006->80/tcp tei-embedding-server f21e82efa1fa opea/vllm-cpu:latest "python3 -m vllm.ent…" 3 hours ago Up 3 hours (healthy) 0.0.0.0:9009->80/tcp, [::]:9009->80/tcp vllm-service 3b541ceeaf9f neo4j:latest "tini -g -- /startup…" 3 hours ago Up 3 hours 7473/tcp, 0.0.0.0:11631->7474/tcp, [::]:11631->7474/tcp, 0.0.0.0:11632->7687/tcp, [::]:11632->7687/tcp neo4j-apoc ``` ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/aipc/README.md Instructions on how to set up necessary environment variables for running the GenAIExamples project, including host IP, Huggingface token, and proxy settings. ```APIDOC ## Environment Variable Setup ### Description Set up environment variables required by the `compose.yaml` file. ### Setup Host IP Export the public IP address of your AIPC to the `host_ip` environment variable. ```bash export host_ip="External_Public_IP" ``` **Note:** Replace `External_Public_IP` with your actual IPv4 address. For Linux, use `hostname -I | awk '{print $1}'`. For Windows, use `ipconfig | findstr /i "IPv4"`. ### Setup Huggingface Token Export your Huggingface API token to the `HF_TOKEN` environment variable. ```bash export HF_TOKEN="Your_Huggingface_API_Token" ``` **Note:** Replace `Your_Huggingface_API_Token` with your actual token. ### Setup No Proxy List Append the public IP address to the `no_proxy` list if you are in a proxy environment. ```bash export your_no_proxy=${your_no_proxy},"External_Public_IP",chatqna-aipc-backend-server,tei-embedding-service,retriever,tei-reranking-service,redis-vector-db,dataprep-redis-service,ollama-service ``` ### Linux Environment Variables ```bash export no_proxy=${your_no_proxy} export http_proxy=${your_http_proxy} export https_proxy=${your_http_proxy} export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" export RERANK_MODEL_ID="BAAI/bge-reranker-base" export INDEX_NAME="rag-redis" export HF_TOKEN=${HF_TOKEN} export OLLAMA_HOST=${host_ip} export OLLAMA_MODEL="llama3.2" ``` ### Windows Environment Variables ```bash set EMBEDDING_MODEL_ID=BAAI/bge-base-en-v1.5 set RERANK_MODEL_ID=BAAI/bge-reranker-base set INDEX_NAME=rag-redis set HF_TOKEN=%HF_TOKEN% set OLLAMA_HOST=host.docker.internal set OLLAMA_MODEL="llama3.2" ``` **Note:** For Windows, replace `host_ip` with your external IP address, not localhost. ``` -------------------------------- ### Cleanup MultimodalQnA Deployment with Docker Compose Source: https://github.com/opea-project/genaiexamples/blob/main/MultimodalQnA/docker_compose/intel/hpu/gaudi/README.md This bash script stops and removes the Docker containers associated with the MultimodalQnA deployment. It uses docker compose down command on compose.yaml for Redis-based setup or compose_milvus.yaml for Milvus-based setup. Requires Docker Compose installed and the relevant compose files in the current directory. ```bash docker compose -f compose.yaml down # if used milvus docker compose -f compose_milvus.yaml down ``` -------------------------------- ### Clone and Setup AgentQnA Repository Source: https://github.com/opea-project/genaiexamples/blob/main/AgentQnA/docker_compose/intel/hpu/gaudi/README.md Clones the GenAIExamples repository and navigates to the AgentQnA directory. Includes optional commands to checkout a specific released version for stable deployment. Requires Git and internet connectivity. ```bash export WORKDIR= cd $WORKDIR git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/AgentQnA # To checkout a released version, such as v1.4: git checkout v1.4 ``` -------------------------------- ### System Prompt Management API Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md APIs for managing the system's behavior through prompts, including getting, updating, resetting, and using custom prompt files. ```APIDOC ## GET /v1/chatqna/prompt ### Description Retrieves the current system prompt. ### Method GET ### Endpoint `/v1/chatqna/prompt` ### Parameters None ### Response #### Success Response (200) (No specific success response schema provided in the source) ## POST /v1/chatqna/prompt ### Description Updates the system prompt with a new custom prompt. ### Method POST ### Endpoint `/v1/chatqna/prompt` ### Parameters #### Request Body - **prompt** (string) - Required - The new system prompt content. ### Request Example ```json { "prompt": "This is a template prompt" } ``` ### Response #### Success Response (200) (No specific success response schema provided in the source) ## POST /v1/chatqna/prompt/reset ### Description Resets the system prompt to its default value. ### Method POST ### Endpoint `/v1/chatqna/prompt/reset` ### Parameters None ### Response #### Success Response (200) (No specific success response schema provided in the source) ## POST /v1/chatqna/prompt-file ### Description Uses a custom system prompt from a file. ### Method POST ### Endpoint `/v1/chatqna/prompt-file` ### Parameters #### Request Body - **file** (file) - Required - The prompt file to upload. Should be in multipart/form-data format. ### Response #### Success Response (200) (No specific success response schema provided in the source) ``` -------------------------------- ### Check All Pipelines - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md Retrieves a list of all configured pipelines using a GET request to the /v1/settings/pipelines endpoint. The response, typically JSON, is pretty-printed using jq. ```bash curl -X GET http://${HOST_IP}:16010/v1/settings/pipelines -H "Content-Type: application/json" | jq '.' ``` -------------------------------- ### Launch UI Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/aipc/README.md Instructions to access the project's frontend UI. ```APIDOC ## 🚀 Launch the UI ### Description Access the project's frontend by opening the provided URL in your web browser. ### URL Open `http://{host_ip}:80` in your browser. ``` -------------------------------- ### Build UI Docker Image Source: https://github.com/opea-project/genaiexamples/blob/main/DocSum/ui/gradio/README.md Builds the frontend Docker image with proxy settings. Navigate to the specified directory before running the command. ```bash cd GenAIExamples/DocSum/ui docker build -t opea/docsum-gradio-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f docker/Dockerfile.gradio . ``` -------------------------------- ### Get Ingested Files List (curl) Source: https://context7.com/opea-project/genaiexamples/llms.txt This command retrieves a list of all files that have been successfully ingested by the Data Preparation Service. It sends a POST request to the /v1/dataprep/get_file endpoint. ```bash curl -X POST http://localhost:6007/v1/dataprep/get_file \ -H "Content-Type: application/json" ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/amd/cpu/epyc/README_qdrant.md Initiates all required Docker containers for the Opea project by running the Docker Compose command. Ensure you are in the directory containing the `compose_qdrant.yaml` file before execution. ```bash cd GenAIExamples/ChatQnA/docker_compose/amd/cpu/epyc/ docker compose -f compose_qdrant.yaml up -d ``` -------------------------------- ### Clone GenAIExample Repository Source: https://github.com/opea-project/genaiexamples/blob/main/SearchQnA/docker_compose/intel/hpu/gaudi/README.md Commands to clone the GenAIExample repository and navigate to the SearchQnA Intel Gaudi platform directory. Includes version checkout for specific release. Requires git installed and network access to GitHub. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/SearchQnA/docker_compose/intel ``` ```bash git checkout v1.3 ``` -------------------------------- ### List Available LLM Models (curl) Source: https://context7.com/opea-project/genaiexamples/llms.txt This command retrieves a list of all available models that can be used with the LLM service. It's a simple GET request to the /v1/models endpoint. ```bash curl http://localhost:9009/v1/models ``` -------------------------------- ### Check All Models - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md Retrieves a list of all loaded models in the RAG system using a GET request to the /v1/settings/models endpoint. The JSON response is pretty-printed using jq. ```bash curl -X GET http://${HOST_IP}:16010/v1/settings/models -H "Content-Type: application/json" | jq '.' ``` -------------------------------- ### Launch UI Configuration Source: https://github.com/opea-project/genaiexamples/blob/main/VideoQnA/docker_compose/intel/cpu/xeon/README.md Example `compose.yaml` snippet showing how to map a host port to the UI service for frontend access. ```yaml videoqna-xeon-ui-server: image: opea/videoqna-ui:latest ... ports: - "80:5173" # port map to host port 80 ``` -------------------------------- ### Check Specific Model - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md Retrieves details for a specific model identified by its ID using a GET request to the /v1/settings/models/{model_id} endpoint. The JSON response is pretty-printed with jq. ```bash curl -X GET http://${HOST_IP}:16010/v1/settings/models/BAAI/bge-reranker-large -H "Content-Type: application/json" | jq '.' ``` -------------------------------- ### Run Frontend with Python Source: https://github.com/opea-project/genaiexamples/blob/main/DocSum/ui/gradio/README.md Starts the frontend application directly using Python. Navigate to the specified directory before running the command. ```bash cd GenAIExamples/DocSum/ui/gradio python docsum_ui_gradio.py ``` -------------------------------- ### Check All Knowledge Bases - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md Retrieves a list of all knowledge bases configured in the RAG system using a GET request to the /v1/knowledge endpoint. The JSON response is pretty-printed using jq. ```bash curl -X GET http://${HOST_IP}:16010/v1/knowledge -H "Content-Type: application/json" | jq '.' ``` -------------------------------- ### Validate AudioQnA Microservices via Curl Source: https://github.com/opea-project/genaiexamples/blob/main/AudioQnA/README_miscellaneous.md Tests AudioQnA microservices by sending a text-to-speech request. Useful for troubleshooting 'Access Denied' errors. Requires curl to be installed and running microservices. ```bash curl http://${host_ip}:7055/v1/audio/speech -XPOST -d '{"input": "Who are you?"}' -H 'Content-Type: application/json' --output speech.mp3 ``` -------------------------------- ### Start Microservice Docker Containers Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/amd/cpu/epyc/README_faqgen.md Initiates the Docker containers for the microservices using docker-compose. This command should be run from the specified directory to ensure correct service deployment. ```bash cd GenAIExamples/FaqGen/docker_compose/amd/cpu/epyc docker compose up -d ``` -------------------------------- ### Question Answering with Web Search using curl Source: https://context7.com/opea-project/genaiexamples/llms.txt This snippet demonstrates how to get answers to questions enhanced with real-time web search results. It sends a JSON payload with the query, and the response includes information from the web. ```bash curl -X POST http://localhost:8888/v1/searchqna \ -H "Content-Type: application/json" \ -d '{ \ "messages": "What are the latest developments in quantum computing?", \ "max_tokens": 1024, \ "stream": false \ }' ``` -------------------------------- ### Python Script for Automated Deployment Source: https://context7.com/opea-project/genaiexamples/llms.txt This section describes using a Python script for automated deployment of ChatQnA, featuring hardware detection and configuration. It demonstrates how to specify chart name, namespace, configuration files, number of nodes, and node labels for targeted deployments, such as on Gaudi hardware. ```bash python deploy.py \ --chart-name chatqna \ --namespace chatqna-ns \ --deploy-config ./configs/chatqna-gaudi-config.yaml \ --num-nodes 2 \ --label node-type=gaudi ``` -------------------------------- ### LLM Non-Streaming Completion (curl) Source: https://context7.com/opea-project/genaiexamples/llms.txt This snippet demonstrates how to get a non-streaming completion from an LLM service using curl. It sends a POST request with the model, user messages, and specifies 'stream: false' for a single response. ```bash curl -X POST http://localhost:9009/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "meta-llama/Meta-Llama-3-8B-Instruct", "messages": [ {"role": "user", "content": "Write a Python function to calculate fibonacci numbers"} ], "max_tokens": 1024, "temperature": 0.1, "stream": false }' ``` -------------------------------- ### Run Python Application for CodeGen Gradio UI Source: https://github.com/opea-project/genaiexamples/blob/main/CodeGen/ui/gradio/README.md This bash command navigates to the gradio directory and executes the Python script codegen_ui_gradio.py. It requires Python and the Gradio dependencies installed. The script starts the UI application directly, bypassing Docker. ```bash cd GenAIExamples/CodeGen/ui/gradio python codegen_ui_gradio.py ``` -------------------------------- ### Clone GenAIExamples repository and navigate to AgentQnA (bash) Source: https://github.com/opea-project/genaiexamples/blob/main/AgentQnA/docker_compose/intel/cpu/xeon/README.md Exports a working directory variable, clones the GenAIExamples repository from GitHub, and changes into the AgentQnA subdirectory. This prepares the local file system for subsequent deployment steps. No external dependencies beyond Git and network access are required. ```bash export WORKDIR= cd $WORKDIR git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/AgentQnA ``` -------------------------------- ### Enable and Check Pipeline Benchmark - Bash Source: https://github.com/opea-project/genaiexamples/blob/main/EdgeCraftRAG/docs/API_Guide.md Enables benchmarking for pipelines by setting the ENABLE_BENCHMARK environment variable to 'true' and then checks benchmark data for a specified pipeline using a GET request. This operation should not be performed in production due to potential performance impact. ```bash # Set ENABLE_BENCHMARK as true before launch services export ENABLE_BENCHMARK="true" # check the benchmark data for pipeline {pipeline_name} curl -X GET http://${HOST_IP}:16010/v1/settings/pipelines/{pipeline_name}/benchmark -H "Content-Type: application/json" | jq '.' ``` -------------------------------- ### Deploy SearchQnA on Intel Xeon Processors Source: https://github.com/opea-project/genaiexamples/blob/main/SearchQnA/docker_compose/intel/cpu/xeon/README.md Complete deployment workflow for SearchQnA application using GenAIComps microservices on Intel Xeon servers. Includes repository setup, environment configuration, Docker Compose deployment, status checking, and pipeline validation. Requires Docker, git, and access to GenAIExamples repository with appropriate API keys for Google and HuggingFace services. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/SearchQnA/docker_compose/intel ``` ```bash git checkout v1.3 ``` ```bash export host_ip="External_Public_IP" # ip address of the node export GOOGLE_CSE_ID="your cse id" export GOOGLE_API_KEY="your google api key" export HF_TOKEN="Your_HuggingFace_API_Token" export http_proxy="Your_HTTP_Proxy" # http proxy if any export https_proxy="Your_HTTPs_Proxy" # https proxy if any export no_proxy=localhost,127.0.0.1,$host_ip # additional no proxies if needed export NGINX_PORT=${your_nginx_port} # your usable port for nginx, 80 for example source ./set_env.sh ``` ```bash cd cpu/xeon docker compose -f compose.yaml up -d ``` ```bash docker ps -a ``` ```bash curl http://${host_ip}:3008/v1/searchqna -H "Content-Type: application/json" -d '{ "messages": "What is the latest news? Give me also the source link.", "stream": "true" }' ``` -------------------------------- ### Start Microservices with Docker Compose Source: https://github.com/opea-project/genaiexamples/blob/main/VisualQnA/docker_compose/amd/cpu/epyc/README.md Initiates all the microservices as Docker containers using Docker Compose. It requires navigating to the correct directory and using either `compose.yaml` for vLLM or `compose_tgi.yaml` if TGI is used as the LLM backend. ```bash cd GenAIExamples/VisualQnA/docker_compose/amd/cpu/epyc docker compose -f compose.yaml up -d # if use TGI as the LLM serving backend docker compose -f compose_tgi.yaml up -d ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/xeon/README_qdrant.md Set up necessary environment variables for the ChatQnA application, including host IP, Huggingface token, and model IDs. ```APIDOC ## Environment Variable Setup ### Description Set up necessary environment variables for the ChatQnA application, including host IP, Huggingface token, and model IDs. Ensure to replace placeholder values with your actual configurations. ### Export Host IP ```bash export host_ip="External_Public_IP" ``` ### Export Huggingface API Token ```bash export your_hf_api_token="Your_Huggingface_API_Token" ``` ### Configure No Proxy ```bash export your_no_proxy=${your_no_proxy} export no_proxy=${your_no_proxy} export http_proxy=${your_http_proxy} export https_proxy=${your_http_proxy} ``` ### Model and Index Configuration ```bash export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" export RERANK_MODEL_ID="BAAI/bge-reranker-base" export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct" export INDEX_NAME="rag-qdrant" ``` **Note:** Replace `External_Public_IP` with your actual external IP address. Do not use `localhost`. ``` -------------------------------- ### Launch AgentQnA services with OpenAI models via Docker Compose (bash) Source: https://github.com/opea-project/genaiexamples/blob/main/AgentQnA/docker_compose/intel/cpu/xeon/README.md Runs Docker Compose with the base compose file and an OpenAI‑specific overlay to start all AgentQnA microservices, including the DocIndexRetriever tool. The command runs containers in detached mode. Ensure that OPENAI_API_KEY is set and Docker is installed. ```bash docker compose -f $WORKDIR/GenAIExamples/DocIndexRetriever/docker_compose/intel/cpu/xeon/compose.yaml -f compose_openai.yaml up -d ``` -------------------------------- ### Build GraphRAG Backend Docker Image Source: https://github.com/opea-project/genaiexamples/blob/main/GraphRAG/docker_compose/intel/cpu/xeon/README.md Builds the main GraphRAG Docker image. Must be executed from the GraphRAG directory to ensure correct context. ```bash cd ~/GenAIExamples/GraphRAG docker build -t opea/graphrag:latest . ``` -------------------------------- ### Clone GenAIExamples Repository (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/Translation/docker_compose/amd/cpu/epyc/README.md Clones the GenAIExamples repository to access Translation Docker Compose files and scripts for AMD EPYC platform. Requires Git installed on the system. No inputs needed; outputs a local directory structure with deployment files. Limitation: Assumes internet access for cloning. ```bash git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/Translation/docker_compose/amd/cpu/epyc/ ``` -------------------------------- ### Build UI Docker Image Source: https://github.com/opea-project/genaiexamples/blob/main/ArbPostHearingAssistant/README_miscellaneous.md Builds the frontend Docker image for the ArbPostHearingAssistant project. This command navigates to the UI directory within the GenAIExamples repository and executes the docker build command, specifying the target image tag and passing proxy environment variables. ```bash cd GenAIExamples/ArbPostHearingAssistant/ui docker build -t opea/arb-post-hearing-assistant-gradio-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile . ``` -------------------------------- ### Run VisualQnA Benchmark Script in Bash Source: https://github.com/opea-project/genaiexamples/blob/main/VisualQnA/benchmark/performance/README.md This bash command executes the benchmark.sh script with the node count parameter to perform inference tests on the deployed VisualQnA service. The -n flag specifies the number of test nodes, and results are collected in the predefined output directory. It assumes the service is already deployed and GenAIEval is installed. ```bash bash benchmark.sh -n ``` -------------------------------- ### Docker Compose Gaudi Service Configuration Source: https://github.com/opea-project/genaiexamples/blob/main/CodeGen/docker_compose/intel/hpu/gaudi/README.md An example YAML snippet illustrating the configuration for a Gaudi-accelerated service within a Docker Compose file. This setup includes specifying the Habana runtime, mounting device files, adding necessary capabilities, and making Gaudi devices visible to the container. ```yaml runtime: habana volumes: - /dev/vfio:/dev/vfio cap_add: - SYS_NICE ipc: host environment: HABANA_VISIBLE_DEVICES: all ``` -------------------------------- ### ChatQnA Gaudi YAML Configuration Source: https://context7.com/opea-project/genaiexamples/llms.txt YAML configuration file for deploying ChatQnA on Gaudi devices, specifying model IDs, replicas, and resources for backend, TEI, retriever, teirerank, and LLM services. Requires Kubernetes and Helm for full deployment functionality. Inputs include Hugging Face token and model paths; outputs configuration for container orchestration. Limited to Gaudi hardware with predefined resource allocations. ```yaml HF_TOKEN: "your-token" device: gaudi node: 2 modelUseHostPath: "/mnt/models" version: "1.1.0" services: backend: replicaCount: 1 tei: enabled: true model_id: "BAAI/bge-base-en-v1.5" replicaCount: 1 resources: cores_per_instance: 4 memory_capacity: "8Gi" retriever: enabled: true replicaCount: 2 teirerank: enabled: true model_id: "BAAI/bge-reranker-base" replicaCount: 1 llm: enabled: true model_id: "meta-llama/Meta-Llama-3-8B-Instruct" engine: "tgi" replicaCount: 1 resources: cards_per_instance: 1 model_params: tgi: batch_params: max_batch_size: 128 max_input_length: 2048 max_total_tokens: 4096 token_params: max_new_tokens: 1024 ``` -------------------------------- ### Deploy Services Using Docker Compose for vLLM (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/SearchQnA/docker_compose/amd/gpu/rocm/README.md Deploys SearchQnA microservices in detached mode using the vLLM-specific Docker Compose file. Requires Docker and Compose installed, plus prior environment configuration. Starts services on AMD ROCm; check logs for status, limitations include GPU resource availability. ```bash docker compose -f compose_vllm.yaml up -d ``` -------------------------------- ### Setup Environment Variables for Microservices Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/xeon/README_faqgen.md These commands export essential environment variables required for the Docker Compose setup. Replace placeholders like 'your_no_proxy', 'your_http_proxy', 'your_host_ip', and 'your_hf_api_token' with your actual values. These variables configure network access, LLM model details, and proxy settings. ```bash export no_proxy=${your_no_proxy} export http_proxy=${your_http_proxy} export https_proxy=${your_http_proxy} export host_ip=${your_host_ip} export LLM_ENDPOINT_PORT=8008 export LLM_SERVICE_PORT=9000 export FAQGEN_BACKEND_PORT=8888 export FAQGen_COMPONENT_NAME="OpeaFaqGenvLLM" export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct" export HF_TOKEN=${your_hf_api_token} export MEGA_SERVICE_HOST_IP=${host_ip} export LLM_SERVICE_HOST_IP=${host_ip} export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8888/v1/faqgen" ``` -------------------------------- ### Deploy AgentQnA Services with TGI on ROCm (Bash) Source: https://github.com/opea-project/genaiexamples/blob/main/AgentQnA/docker_compose/amd/gpu/rocm/README.md This snippet navigates to the ROCm Docker Compose directory and launches AgentQnA services using the TGI backend. It requires Docker, Docker Compose, and ROCm on AMD GPU server. Starts containers including tgi-service; verify all services are running post-deployment, building on environment setup. ```bash cd GenAIExamples/AgentQnA/docker_compose/amd/gpu/rocm bash launch_agent_service_tgi_rocm.sh ``` -------------------------------- ### TGI-based Deployment Source: https://github.com/opea-project/genaiexamples/blob/main/CodeGen/docker_compose/amd/cpu/epyc/README.md Instructions for deploying services using the Hugging Face Text Generation Inference (TGI) serving engine. This includes specifying the profile and the command to start the services. ```APIDOC ## TGI-based Deployment (`--profile codegen-epyc-tgi`) ### Description Uses Hugging Face Text Generation Inference (TGI) as the LLM serving engine. Deploys services like `codegen-tgi-server`, `codegen-llm-server`, `codegen-tei-embedding-server`, `codegen-retriever-server`, `redis-vector-db`, `codegen-dataprep-server`, `codegen-backend-server`, and `codegen-gradio-ui-server`. ### Method Bash ### Endpoint N/A (Docker Compose command) ### Parameters #### Environment Variables - **host_ip** (string) - Required - The IP address of the host machine. - **HF_TOKEN** (string) - Required - Hugging Face API token. ### Command ```bash docker compose --profile codegen-epyc-tgi up -d ``` ### Expected Output Services related to the `codegen-epyc-tgi` profile are started in detached mode. ``` -------------------------------- ### Install Python Requirements in Bash Source: https://github.com/opea-project/genaiexamples/blob/main/README-deploy-benchmark.md This bash command installs necessary Python packages for benchmarking OPEA projects. It depends on Python and pip being installed, with input from a requirements.txt file. Outputs are installed packages; limitations include potential version conflicts if opea-eval is not at v1.3 or later. ```bash pip install -r requirements.txt ``` -------------------------------- ### Build MegaService Docker Image (ChatQnA) Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/docker_compose/intel/cpu/xeon/README_faqgen.md Constructs the MegaService Docker image for the ChatQnA application. This process involves cloning the GenAIExamples repository, navigating to the ChatQnA directory, and building the Docker image using the provided Dockerfile and proxy configurations. ```bash git clone https://github.com/opea-project/GenAIExamples cd GenAIExamples/ChatQnA docker build --no-cache -t opea/chatqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . ``` -------------------------------- ### Build ChatQnA Docker Images Source: https://github.com/opea-project/genaiexamples/blob/main/ChatQnA/README_miscellaneous.md Commands to build the ChatQnA MegaService and frontend UI Docker images. Requires Git, Docker, and proxy environment variables (https_proxy, http_proxy). Supports building MegaService, Basic UI, and Conversational React UI images with proper tagging and proxy configuration. ```bash git clone https://github.com/opea-project/GenAIExamples.git git fetch && git checkout v1.3 cd GenAIExamples/ChatQnA docker build --no-cache -t opea/chatqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . ``` ```bash cd GenAIExamples/ChatQnA/ui docker build --no-cache -t opea/chatqna-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile . ``` ```bash cd GenAIExamples/ChatQnA/ui docker build --no-cache -t opea/chatqna-conversation-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile.react . ``` -------------------------------- ### Install Docker using Script Source: https://github.com/opea-project/genaiexamples/blob/main/CodeTrans/docker_compose/amd/cpu/epyc/README.md Installs Docker and its dependencies on the system using a provided shell script. It's recommended to verify the installation afterwards. ```bash source ./install_docker.sh docker --version ``` -------------------------------- ### POST /start_profile Source: https://github.com/opea-project/genaiexamples/blob/main/CodeGen/docker_compose/amd/cpu/epyc/README.md Starts profiling for the vLLM backend service. This endpoint initializes profiling for the specified model. ```APIDOC ## POST /start_profile ### Description Starts profiling for the vLLM backend service. This endpoint initializes profiling for the specified model. ### Method POST ### Endpoint http://${host_ip}:8028/start_profile ### Parameters #### Request Body - **model** (string) - Required - The model identifier to start profiling (e.g., "Qwen/Qwen2.5-Coder-7B-Instruct"). ### Request Example { "model": "Qwen/Qwen2.5-Coder-7B-Instruct" } ### Response #### Success Response (200) - **status** (string) - Indicates the profiling status (e.g., "Profiling started"). ```