### Copy Environment Example Source: https://ragflow.io/docs/sandbox_quickstart Copy the example environment file to start configuring your sandbox settings. ```bash cp .env.example .env ``` -------------------------------- ### Test Sandbox Setup Source: https://ragflow.io/docs/sandbox_quickstart Activate the virtual environment, set the Python path, install dependencies, and run security tests for the sandbox. ```bash source .venv/bin/activate export PYTHONPATH=$(pwd) uv pip install -r executor_manager/requirements.txt uv run tests/sandbox_security_tests_full.py ``` -------------------------------- ### Start RAGFlow Services (Custom Project Name) Source: https://ragflow.io/docs/backup_and_migration Start RAGFlow services on the target machine using a custom project name. Ensure the project name matches the one used during setup. ```bash docker compose -p ragflow -f docker/docker-compose.yml up -d ``` -------------------------------- ### Run All Setup and Tests with Makefile Source: https://ragflow.io/docs/sandbox_quickstart Execute all setup, build, launch, and testing commands with a single Makefile command. ```bash make ``` -------------------------------- ### Launch RAGFlow Frontend Service Source: https://ragflow.io/docs/launch_ragflow_from_source Navigate to the 'web' directory, install frontend dependencies using npm, and start the development server. Ensure the vite.config.ts is updated to point to the correct backend proxy target. ```bash cd web npm install ``` ```bash vim vite.config.ts ``` ```bash npm run dev ``` -------------------------------- ### Start Xinference Local Instance Source: https://ragflow.io/docs/deploy_local_llm Starts a local Xinference instance. Ensure your firewall allows inbound connections on port 9997. ```bash $ xinference-local --host 0.0.0.0 --port 9997 ``` -------------------------------- ### Install vLLM Source: https://ragflow.io/docs/v0.25.4/deploy_local_llm Install the vLLM library using pip. This is a prerequisite for deploying vLLM models. ```bash pip install vllm ``` -------------------------------- ### Configure Installation Booking Agent User Prompt Source: https://ragflow.io/docs/ecommerce_customer_support_agent Set the user prompt for the 'Installation Booking Agent'. This prompt is used to capture user queries for installation bookings. ```text User's query is /(Begin Input) sys.query ``` -------------------------------- ### Install Frontend Dependencies Source: https://ragflow.io/docs/v0.25.4/launch_ragflow_from_source Navigate to the 'web' directory and install the necessary Node.js dependencies for the RAGFlow frontend using npm. ```bash cd web npm install ``` -------------------------------- ### Construct RAPTOR Request Example Source: https://ragflow.io/docs/http_api_reference Example cURL command to initiate the construction of a RAPTOR from a specified dataset. Requires an API key for authorization. ```bash curl --request POST \ --url http://{address}/api/v1/datasets/{dataset_id}/run_raptor \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Install RAGFlow Python SDK Source: https://ragflow.io/docs/python_api_reference Run this command to download the RAGFlow Python SDK. Ensure you have pip installed. ```bash pip install ragflow-sdk ``` -------------------------------- ### Get All Parent Folders Request Example Source: https://ragflow.io/docs/http_api_reference Example cURL command to retrieve all parent folders of a specified file. ```bash curl --request GET \ --url 'http://{address}/api/v1/files/{file_id}/ancestors' \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Get Knowledge Graph Construction Status Request Example Source: https://ragflow.io/docs/http_api_reference Example cURL command to retrieve the construction status of a knowledge graph for a specified dataset. ```bash curl --request GET \ --url http://{address}/api/v1/datasets/{dataset_id}/trace_graphrag \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Example HTTP Request Response Source: https://ragflow.io/docs/http_request_component This is an example of a response structure from an HTTP GET request, showing parsed arguments, headers, origin IP, and the request URL. ```json { "args": { "App": "RAGFlow", "Query": "How to do?", "Userid": "241ed25a8e1011f0b979424ebc5b108b" }, "headers": { "Accept": "/", "Accept-Encoding": "gzip, deflate, br, zstd", "Cache-Control": "no-cache", "Host": "httpbin.org", "User-Agent": "python-requests/2.32.2", "X-Amzn-Trace-Id": "Root=1-68c9210c-5aab9088580c130a2f065523" }, "origin": "185.36.193.38", "url": "https://httpbin.org/get?Userid=241ed25a8e1011f0b979424ebc5b108b&App=RAGFlow&Query=How+to+do%3F" } ``` -------------------------------- ### Run vLLM with Best Practices Source: https://ragflow.io/docs/deploy_local_llm Use this command to start the vLLM server with specified model, port, and GPU utilization. Redirect logs to a file for monitoring. ```bash nohup vllm serve /data/Qwen3-8B --served-model-name Qwen3-8B-FP8 --dtype auto --port 1025 --gpu-memory-utilization 0.90 --tool-call-parser hermes --enable-auto-tool-choice > /var/log/vllm_startup1.log 2>&1 & ``` -------------------------------- ### List All System Configurations Source: https://ragflow.io/docs/v0.25.4/admin_cli List all system configurations available in the Admin CLI. ```bash ragflow> list configs; +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ | extra | host | id | name | port | service_type | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ | {} | 0.0.0.0 | 0 | ragflow_0 | 9380 | ragflow_server | | {'meta_type': 'mysql', 'password': 'infini_rag_flow', 'username': 'root'} | localhost | 1 | mysql | 5455 | meta_data | | {'password': 'infini_rag_flow', 'store_type': 'minio', 'user': 'rag_flow'} | localhost | 2 | minio | 9000 | file_store | | {'password': 'infini_rag_flow', 'retrieval_type': 'elasticsearch', 'username': 'elastic'} | localhost | 3 | elasticsearch | 1200 | retrieval | | {'db_name': 'default_db', 'retrieval_type': 'infinity'} | localhost | 4 | infinity | 23817 | retrieval | | {'database': 1, 'mq_type': 'redis', 'password': 'infini_rag_flow'} | localhost | 5 | redis | 6379 | message_queue | | {'message_queue_type': 'redis'} | | 6 | task_executor | 0 | task_executor | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ ``` -------------------------------- ### Get Chat Assistant Request Example Source: https://ragflow.io/docs/http_api_reference Example using curl to retrieve a specific chat assistant by its ID. Ensure to replace `{address}` and `{chat_id}` with actual values. ```bash curl --request GET \ --url http://{address}/api/v1/chats/{chat_id} \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Get RAPTOR Construction Status Request Example Source: https://ragflow.io/docs/http_api_reference Example cURL command to retrieve the status of a RAPTOR construction task. Requires the dataset ID and an API key. ```bash curl --request GET \ --url http://{address}/api/v1/datasets/{dataset_id}/trace_raptor \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Launch RAGFlow Backend Service Source: https://ragflow.io/docs/launch_ragflow_from_source Prepare the environment by activating the virtual environment, setting PYTHONPATH, and optionally configuring HuggingFace mirror. Then, launch the backend service using entrypoint.sh. ```bash # /usr/sbin/nginx ``` ```bash source .venv/bin/activate export PYTHONPATH=$(pwd) ``` ```bash export HF_ENDPOINT=https://hf-mirror.com ``` ```bash JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so; LD_PRELOAD=$JEMALLOC_PATH python rag/svr/task_executor.py 1; ``` ```bash python api/ragflow_server.py; ``` -------------------------------- ### Get Parent Folder Failure Response Source: https://ragflow.io/docs/http_api_reference Example of a failure response when the parent folder is not found. ```json { "code": 404, "message": "Folder not found!" } ``` -------------------------------- ### Configure Usage Guide Agent System Prompt Source: https://ragflow.io/docs/ecommerce_customer_support_agent Define the system prompt for the 'Usage Guide Agent'. This instructs the agent to provide step-by-step product usage instructions. ```text You are a product usage guide assistant. Provide step‑by‑step instructions for setup, operation, and troubleshooting. ``` -------------------------------- ### Create Folder Request Example Source: https://ragflow.io/docs/http_api_reference Use this example to create a new folder within the system. Ensure you replace `{address}` and `{folder_id}` with your specific values. ```curl curl --request POST \ --url http://{address}/api/v1/files \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data '{ "name": "New Folder", "type": "folder", "parent_id": "{folder_id}" }' ``` -------------------------------- ### Initialize RAGFlow and Manage Datasets/Documents Source: https://ragflow.io/docs/v0.25.4/python_api_reference Demonstrates initializing the RAGFlow SDK with API credentials and base URL, listing datasets, and adding chunks to documents. ```python from ragflow_sdk import RAGFlow rag_object = RAGFlow(api_key="", base_url="http://:9380") dataset = rag_object.list_datasets(id="123") dataset = dataset[0] doc = dataset.list_documents(id="wdfxb5t547d") doc = doc[0] chunk = doc.add_chunk(content="xxxxxxx") chunk.update({"content":"sdfx..."}) ``` -------------------------------- ### Get Chat Session Failure Response Source: https://ragflow.io/docs/v0.25.4/http_api_reference Example of a failure response when a specified chat session is not found. ```json { "code": 102, "message": "Session not found!" } ``` -------------------------------- ### List All Available Services Source: https://ragflow.io/docs/v0.25.4/admin_cli Use the 'list services;' command to display all registered services, their status, host, port, and configuration details. ```bash ragflow> list services; command: list services; Listing all services +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ | extra | host | id | name | port | service_type | status | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ | {} | 0.0.0.0 | 0 | ragflow_0 | 9380 | ragflow_server | Timeout | | {'meta_type': 'mysql', 'password': 'infini_rag_flow', 'username': 'root'} | localhost | 1 | mysql | 5455 | meta_data | Alive | | {'password': 'infini_rag_flow', 'store_type': 'minio', 'user': 'rag_flow'} | localhost | 2 | minio | 9000 | file_store | Alive | | {'password': 'infini_rag_flow', 'retrieval_type': 'elasticsearch', 'username': 'elastic'} | localhost | 3 | elasticsearch | 1200 | retrieval | Alive | | {'db_name': 'default_db', 'retrieval_type': 'infinity'} | localhost | 4 | infinity | 23817 | retrieval | Timeout | | {'database': 1, 'mq_type': 'redis', 'password': 'infini_rag_flow'} | localhost | 5 | redis | 6379 | message_queue | Alive | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ ``` -------------------------------- ### Get All Parent Folders Success Response Source: https://ragflow.io/docs/http_api_reference Example of a successful response when retrieving all parent folders of a file. ```json { "code": 0, "data": { "parent_folders": [ { "id": "527fa74891e811ef9c650242ac120006", "name": "Parent Folder 1" }, { "id": "627fa74891e811ef9c650242ac120007", "name": "Parent Folder 2" } ] } } ``` -------------------------------- ### Get Parent Folder Response Source: https://ragflow.io/docs/http_api_reference Example of a successful response when retrieving the immediate parent folder of a file. ```json { "code": 0, "data": { "parent_folder": { "id": "527fa74891e811ef9c650242ac120006", "name": "Parent Folder" } } } ``` -------------------------------- ### List All System Configurations Source: https://ragflow.io/docs/admin_cli The 'list configs' command displays all available system configurations, including their host, port, and service type. This provides an overview of the system's setup. ```bash ragflow> list configs; ``` -------------------------------- ### Install JavaScript Package in Node.js Environment Source: https://ragflow.io/docs/code_component To import custom JavaScript packages, navigate to the `sandbox_base_image/nodejs` directory, use `npm install` to add the package, and then rebuild the Docker image. This example adds the 'lodash' package. ```bash (ragflow) ➜ ragflow/sandbox main ✓ pwd /home/infiniflow/workspace/ragflow/sandbox ``` ```bash (ragflow) ➜ ragflow/sandbox main ✓ cd sandbox_base_image/nodejs ``` ```bash (ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ npm install lodash ``` ```bash (ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ cd ../.. # go back to sandbox root directory ``` ```bash (ragflow) ➜ ragflow/sandbox main ✗ make # rebuild the docker image, this command will rebuild the image and start the service immediately. To build image only, using `make build` instead. ``` ```bash (ragflow) ➜ ragflow/sandbox main ✗ docker exec -it sandbox_nodejs_0 /bin/bash # entering container to check if the package is installed ``` ```bash # in the container nobody@dd4bbcabef63:/workspace$ npm list lodash # verify via npm list /workspace `-- lodash@4.17.21 extraneous ``` ```bash nobody@dd4bbcabef63:/workspace$ ls node_modules | grep lodash # or verify via listing node_modules lodash ``` ```bash # That's okay! ``` -------------------------------- ### Get Chat Assistant Failure Response Source: https://ragflow.io/docs/http_api_reference Example of a failure response when retrieving a chat assistant, indicating an authorization issue. ```json { "code": 102, "message": "No authorization." } ``` -------------------------------- ### Display System Configuration by Name Source: https://ragflow.io/docs/admin_cli Use the 'show var' command to display the value of a specific system configuration item. This is useful for verifying current settings. ```bash ragflow> show var mail.server; ``` -------------------------------- ### Enter Docker container and deploy certificates Source: https://ragflow.io/docs/v0.25.4/config_ssl_cert Access the container's interactive terminal, create the SSL directory, move the certificate files, and set the correct file permissions. ```bash docker exec -it docker-ragflow-cpu-1 /bin/bash mkdir -p /etc/nginx/ssl mv /tmp/fullchain.pem /etc/nginx/ssl/ mv /tmp/privkey.pem /etc/nginx/ssl/ # Set permissions: 644 for public key, 600 for private key chmod 644 /etc/nginx/ssl/fullchain.pem chmod 600 /etc/nginx/ssl/privkey.pem ``` -------------------------------- ### Ragflow API Get Session Failure Response Source: https://ragflow.io/docs/http_api_reference Example of a failure response when trying to retrieve a chat session, indicating that the session was not found. ```json { "code": 102, "message": "Session not found!" } ``` -------------------------------- ### Get Chat Assistant Success Response Source: https://ragflow.io/docs/http_api_reference Example of a successful response when retrieving a chat assistant. It returns the full object of the specified assistant. ```json { "code": 0, "data": { "icon": "", "create_date": "Fri, 18 Oct 2024 06:20:06 GMT", "create_time": 1729232406637, "description": "A helpful Assistant", "id": "04d0d8e28d1911efa3630242ac120006", "dataset_ids": ["527fa74891e811ef9c650242ac120006"], "kb_names": ["dataset_1"], "language": "English", "llm_id": "qwen-plus@Tongyi-Qianwen", "llm_setting": { "temperature": 0.1, "top_p": 0.3 }, "name": "my_chat", "prompt_config": { "empty_response": "Sorry! No relevant content was found in the knowledge base!", "prologue": "Hi! I'm your assistant. What can I do for you?", "quote": true, "system": "You are an intelligent assistant...", "parameters": [{"key": "knowledge", "optional": false}] }, "rerank_id": "", "similarity_threshold": 0.2, "vector_similarity_weight": 0.3, "top_n": 6, "status": "1", "tenant_id": "69736c5e723611efb51b0242ac120007", "update_date": "Fri, 18 Oct 2024 06:20:06 GMT", "update_time": 1729232406638 } } ``` -------------------------------- ### List All System Variables Source: https://ragflow.io/docs/admin_cli Lists all system settings and configurations. This command is case-insensitive and requires a semicolon terminator. ```sql LIST VARS ``` -------------------------------- ### Get Chat Session Success Response Source: https://ragflow.io/docs/v0.25.4/http_api_reference Example of a successful response when retrieving a specific chat session. It includes session details, messages, and references. ```json { "code": 0, "data": { "chat_id": "2ca4b22e878011ef88fe0242ac120005", "id": "4606b4ec87ad11efbc4f0242ac120006", "name": "new session", "avatar": "data:image/png;base64,...", "messages": [ { "content": "Hi! I am your assistant, can I help you?", "role": "assistant" } ], "reference": [] } } ``` -------------------------------- ### Show Help Information Source: https://ragflow.io/docs/v0.25.4/admin_cli Display help information for available commands in the Admin CLI. ```bash ragflow> \help command: \help Commands: LIST SERVICES SHOW SERVICE STARTUP SERVICE SHUTDOWN SERVICE RESTART SERVICE LIST USERS SHOW USER DROP USER CREATE USER ALTER USER PASSWORD ALTER USER ACTIVE LIST DATASETS OF LIST AGENTS OF CREATE ROLE DROP ROLE ALTER ROLE SET DESCRIPTION LIST ROLES SHOW ROLE GRANT ON TO ROLE REVOKE ON TO ROLE ALTER USER SET ROLE SHOW USER PERMISSION SHOW VERSION GRANT ADMIN REVOKE ADMIN GENERATE KEY FOR USER LIST KEYS OF DROP KEY OF Meta Commands: \?, \h, \help Show this help \q, \quit, \exit Quit the CLI ``` -------------------------------- ### List All Available Services Source: https://ragflow.io/docs/admin_cli Use this command to get an overview of all registered services, their status, and configuration details. ```bash ragflow> list services; command: list services; Listing all services +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ | extra | host | id | name | port | service_type | status | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ | {} | 0.0.0.0 | 0 | ragflow_0 | 9380 | ragflow_server | Timeout | | {'meta_type': 'mysql', 'password': 'infini_rag_flow', 'username': 'root'} | localhost | 1 | mysql | 5455 | meta_data | Alive | | {'password': 'infini_rag_flow', 'store_type': 'minio', 'user': 'rag_flow'} | localhost | 2 | minio | 9000 | file_store | Alive | | {'password': 'infini_rag_flow', 'retrieval_type': 'elasticsearch', 'username': 'elastic'} | localhost | 3 | elasticsearch | 1200 | retrieval | Alive | | {'db_name': 'default_db', 'retrieval_type': 'infinity'} | localhost | 4 | infinity | 23817 | retrieval | Timeout | | {'database': 1, 'mq_type': 'redis', 'password': 'infini_rag_flow'} | localhost | 5 | redis | 6379 | message_queue | Alive | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ ``` -------------------------------- ### Get Parent Folder Request Example Source: https://ragflow.io/docs/http_api_reference Retrieve the parent folder information for a given file ID using this request. Replace `{address}` and `{file_id}` with your actual values. ```curl curl --request GET \ --url 'http://{address}/api/v1/files/{file_id}/parent' \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Get Chat Session Request Example (cURL) Source: https://ragflow.io/docs/http_api_reference Use this cURL command to retrieve a specific session of a chat assistant. Replace {address}, {chat_id}, and {session_id} with actual values. ```bash curl --request GET \ --url http://{address}/api/v1/chats/{chat_id}/sessions/{session_id} \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Start Ollama and Pull Model Source: https://ragflow.io/docs/faq Use these commands to start the Ollama server and download a model for local inference. Ensure OLLAMA_HOST is set correctly for accessibility. ```bash export OLLAMA_HOST=0.0.0.0 ollama serve ollama pull llama3 ``` -------------------------------- ### Run vLLM Server Source: https://ragflow.io/docs/v0.25.4/deploy_local_llm Start the vLLM server with specified model, port, and GPU utilization. Logs are redirected to a file for monitoring. ```bash nohup vllm serve /data/Qwen3-8B --served-model-name Qwen3-8B-FP8 --dtype auto --port 1025 --gpu-memory-utilization 0.90 --tool-call-parser hermes --enable-auto-tool-choice > /var/log/vllm_startup1.log 2>&1 & ``` -------------------------------- ### Get Memory Config Request Example Source: https://ragflow.io/docs/http_api_reference This `curl` command demonstrates how to request the configuration of a specific memory using its ID. Ensure you replace `{address}` with your API endpoint and `` with your actual API key. ```bash curl --location 'http://{address}/api/v1/memories/6c8983badede11f083f184ba59bc53c7/config' \ --header 'Authorization: Bearer ' ``` -------------------------------- ### JavaScript Code Example with Axios Source: https://ragflow.io/docs/code_component An asynchronous JavaScript function that uses the 'axios' library to fetch data from a GitHub URL and log the response. Error handling is included. Ensure 'axios' is installed as a dependency if used. ```javascript const axios = require('axios'); async function main(args) { try { const response = await axios.get('https://github.com/infiniflow/ragflow'); console.log('Body:', response.data); } catch (error) { console.error('Error:', error.message); } } ``` -------------------------------- ### Launch Third-Party Services with Docker Compose Source: https://ragflow.io/docs/v0.25.4/launch_ragflow_from_source Start the essential third-party services (MinIO, Elasticsearch, Redis, MySQL) in detached mode using Docker Compose. Ensure Docker and Docker Compose are installed and configured. ```bash docker compose -f docker/docker-compose-base.yml up -d ``` -------------------------------- ### Migrate Data using MinIO Client (mc) Source: https://ragflow.io/docs/backup_and_migration Demonstrates how to copy data from multiple old buckets to a new single bucket with the specified prefix path using the `mc` command-line tool. ```bash # Example using mc (MinIO Client) mc alias set old-minio http://old-minio:9000 ACCESS_KEY SECRET_KEY mc alias set new-minio https://new-minio:443 ACCESS_KEY SECRET_KEY # List all knowledge base buckets mc ls old-minio/ | grep kb_ | while read -r line; do bucket=$(echo $line | awk '{print $5}') # Copy each bucket to the new structure mc cp --recursive old-minio/$bucket/ new-minio/ragflow-bucket/ragflow/$bucket/ done ``` -------------------------------- ### Get Knowledge Graph Request Example Source: https://ragflow.io/docs/http_api_reference This `curl` command demonstrates how to request the knowledge graph for a specific dataset using its ID. Ensure you replace `{address}` and `{dataset_id}` with actual values and include your API key. ```bash curl --request GET \ --url http://{address}/api/v1/datasets/{dataset_id}/knowledge_graph \ --header 'Authorization: Bearer ' ``` -------------------------------- ### List All System Configurations Source: https://ragflow.io/docs/admin_cli Lists all available system configurations. Commands are case-insensitive and must be terminated with a semicolon. ```sql LIST CONFIGS ``` -------------------------------- ### Configure Usage Guide Agent User Prompt Source: https://ragflow.io/docs/ecommerce_customer_support_agent Set the user prompt for the 'Usage Guide Agent'. This specifies how user queries and knowledge base schemas are passed to the agent. ```text User's query is /(Begin Input) sys.query Schema is /(Usage Guide Knowledge Base) formalized_content ``` -------------------------------- ### Get Message Content Example Source: https://ragflow.io/docs/v0.25.4/http_api_reference Use this cURL command to retrieve the full content and embed vector of a specific message. Ensure you replace `{address}` with your RAGFlow backend service host and port, and `` with your actual API key. ```curl curl --location 'http://{address}/api/v1/messages/6c8983badede11f083f184ba59bc53c7:270/content' \ --header 'Authorization: Bearer ' ``` -------------------------------- ### JavaScript Code Example for Code Component Source: https://ragflow.io/docs/v0.25.4/code_component An asynchronous JavaScript function using axios to fetch data from a GitHub URL. It logs the response data or any errors encountered. Ensure necessary packages like axios are installed in the Sandbox environment. ```javascript const axios = require('axios'); async function main(args) { try { const response = await axios.get('https://github.com/infiniflow/ragflow'); console.log('Body:', response.data); } catch (error) { console.error('Error:', error.message); } } ``` -------------------------------- ### Launch Ollama Service with IPEX-LLM (Windows) Source: https://ragflow.io/docs/v0.25.4/deploy_local_llm Launch the Ollama service with IPEX-LLM on Windows, setting necessary environment variables for GPU utilization and caching. ```bash set OLLAMA_NUM_GPU=999 set no_proxy=localhost,127.0.0.1 set ZES_ENABLE_SYSMAN=1 set SYCL_CACHE_PERSISTENT=1 ollama serve ``` -------------------------------- ### Python Code Example for Plot Generation Source: https://ragflow.io/docs/code_component A Python function that generates a simple line chart using matplotlib, saves it as a PNG file in an 'artifacts' directory, and returns a success message along with the file path. Ensure matplotlib is installed. ```python def main() -> dict: from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt artifacts_dir = Path("artifacts") artifacts_dir.mkdir(parents=True, exist_ok=True) x = [1, 2, 3, 4, 5] y = [2, 4, 6, 8, 10] output_path = artifacts_dir / "simple_plot.png" plt.figure(figsize=(6, 4)) plt.plot(x, y, marker="o") plt.title("Simple Line Chart") plt.xlabel("X") plt.ylabel("Y") plt.grid(True) plt.tight_layout() plt.savefig(output_path) plt.close() return { "result": "plot generated successfully", "file_path": str(output_path), } ```