### Install LiteLLM Proxy Source: https://docs.litellm.ai/docs/proxy/quick_start Installs the LiteLLM proxy with necessary dependencies using pip. This command prepares your environment to run the LiteLLM gateway. ```Shell pip install 'litellm[proxy]' ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/groq This command line snippet demonstrates how to start the LiteLLM Proxy server, instructing it to load models and configurations from a specified `config.yaml` file. This is essential for running the proxy with custom model setups. ```bash litellm --config config.yaml ``` -------------------------------- ### Run LiteLLM with TogetherAI Source: https://docs.litellm.ai/docs/proxy/quick_start This example illustrates how to set the `TOGETHERAI_API_KEY` environment variable and then use `litellm` to interact with a TogetherAI model, such as Vicuna-13b. ```bash export TOGETHERAI_API_KEY=my-api-key litellm --model together_ai/lmsys/vicuna-13b-v1.5-16k ``` -------------------------------- ### Example LiteLLM Proxy Configuration File Source: https://docs.litellm.ai/docs/proxy/quick_start This example `config.yaml` demonstrates how to set up a `model_list` for the LiteLLM Proxy. It defines user-facing model aliases and their corresponding `litellm_params`, including model names, API bases, and API keys for Azure and VLLM endpoints. ```yaml model_list: - model_name: gpt-3.5-turbo # user-facing model alias litellm_params: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input model: azure/ api_base: api_key: - model_name: gpt-3.5-turbo litellm_params: model: azure/gpt-turbo-small-ca api_base: https://my-endpoint-canada-berri992.openai.azure.com/ api_key: - model_name: vllm-model litellm_params: model: openai/ api_base: # e.g. http://0.0.0.0:3000/v1 api_key: ``` -------------------------------- ### Run LiteLLM with AI21 Source: https://docs.litellm.ai/docs/proxy/quick_start This example illustrates how to set the `AI21_API_KEY` environment variable and then use `litellm` to interact with an AI21 model like `j2-light`. ```bash export AI21_API_KEY=my-api-key litellm --model j2-light ``` -------------------------------- ### Run LiteLLM with Vertex AI (Gemini) Source: https://docs.litellm.ai/docs/proxy/quick_start This example details how to configure LiteLLM for Vertex AI, including setting the `VERTEX_PROJECT` and `VERTEX_LOCATION` environment variables. It then shows how to invoke a Gemini Pro model. ```bash export VERTEX_PROJECT="hardy-project" export VERTEX_LOCATION="us-west" litellm --model vertex_ai/gemini-pro ``` -------------------------------- ### Example Content for Repository Agent File Source: https://docs.all-hands.dev/usage/prompting/microagents-repo This example demonstrates the expected structure and content of a `.openhands/microagents/repo.md` file. It includes sections for the repository's purpose, setup instructions, file structure, CI/CD workflows, and general development guidelines, providing a comprehensive overview for OpenHands. ```Markdown # Repository Purpose This project is a TODO application that allows users to track TODO items. # Setup Instructions To set it up, you can run `npm run build`. # Repository Structure - `/src`: Core application code - `/tests`: Test suite - `/docs`: Documentation - `/.github`: CI/CD workflows # CI/CD Workflows - `lint.yml`: Runs ESLint on all JavaScript files - `test.yml`: Runs the test suite on pull requests # Development Guidelines Always make sure the tests are passing before committing changes. You can run the tests by running `npm run test`. ``` -------------------------------- ### Run LiteLLM with Petals Source: https://docs.litellm.ai/docs/proxy/quick_start This example shows how to use `litellm` to connect to a model hosted on Petals, specifically a Llama-2-70b-chat-hf model. ```bash litellm --model petals/meta-llama/Llama-2-70b-chat-hf ``` -------------------------------- ### Configure OpenHands Repository Setup with Bash Script Source: https://docs.all-hands.dev/usage/prompting/repository This script (`.openhands/setup.sh`) runs every time OpenHands begins working with your repository. It is an ideal location for installing dependencies, setting environment variables, and performing other initial setup tasks. The example demonstrates exporting an environment variable, updating and installing a system package, and installing npm dependencies for a frontend project. ```bash #!/bin/bash export MY_ENV_VAR="my value" sudo apt-get update sudo apt-get install -y lsof cd frontend && npm install ; cd .. ``` -------------------------------- ### Run LiteLLM with Anthropic Source: https://docs.litellm.ai/docs/proxy/quick_start This example demonstrates how to set the `ANTHROPIC_API_KEY` environment variable and then use `litellm` to interact with an Anthropic model like `claude-instant-1`. ```bash export ANTHROPIC_API_KEY=my-api-key litellm --model claude-instant-1 ``` -------------------------------- ### Run LiteLLM with Ollama Source: https://docs.litellm.ai/docs/proxy/quick_start This example demonstrates how to use `litellm` to interact with a model served by Ollama. You need to replace `` with the actual name of your Ollama model. ```bash litellm --model ollama/ ``` -------------------------------- ### Run LiteLLM with Azure OpenAI Source: https://docs.litellm.ai/docs/proxy/quick_start This example shows how to configure LiteLLM to use Azure OpenAI by setting the `AZURE_API_KEY` and `AZURE_API_BASE` environment variables. It then invokes `litellm` with a specified Azure deployment name. ```bash export AZURE_API_KEY=my-api-key export AZURE_API_BASE=my-api-base litellm --model azure/my-deployment-name ``` -------------------------------- ### Start LiteLLM Proxy with Detailed Debugging Source: https://docs.litellm.ai/docs/proxy/quick_start Starts the LiteLLM proxy with detailed debug logs enabled, useful for troubleshooting. It routes requests to the specified HuggingFace model. ```Shell litellm --model huggingface/bigcode/starcoder --detailed_debug ``` -------------------------------- ### Run LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/proxy/quick_start Demonstrates how to start the LiteLLM proxy using a specified configuration file. This command initializes the proxy with custom settings defined in `your_config.yaml`. ```bash litellm --config your_config.yaml ``` -------------------------------- ### Start New Conversation Examples Source: https://docs.all-hands.dev/usage/cloud/cloud-api Examples demonstrating how to send a POST request to the conversation endpoint to initiate a new task with an initial message and an optional repository context. ```bash curl -X POST "https://app.all-hands.dev/api/conversations" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.", "repository": "yourusername/your-repo" }' ``` ```python import requests api_key = "YOUR_API_KEY" url = "https://app.all-hands.dev/api/conversations" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } data = { "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.", "repository": "yourusername/your-repo" } response = requests.post(url, headers=headers, json=data) conversation = response.json() print(f"Conversation Link: https://app.all-hands.dev/conversations/{conversation['conversation_id']}") print(f"Status: {conversation['status']}") ``` ```typescript const apiKey = "YOUR_API_KEY"; const url = "https://app.all-hands.dev/api/conversations"; const headers = { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" }; const data = { initial_user_msg: "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.", repository: "yourusername/your-repo" }; async function startConversation() { try { const response = await fetch(url, { method: "POST", headers: headers, body: JSON.stringify(data) }); const conversation = await response.json(); console.log(`Conversation Link: https://app.all-hands.dev/conversations/${conversation.id}`); console.log(`Status: ${conversation.status}`); return conversation; } catch (error) { console.error("Error starting conversation:", error); } } startConversation(); ``` -------------------------------- ### Run LiteLLM with Local Huggingface TGI Model Source: https://docs.litellm.ai/docs/proxy/quick_start This example shows how to connect LiteLLM to a Huggingface Text Generation Inference (TGI) model running locally. It specifies the model name and the local API base URL. ```bash litellm --model huggingface/ --api_base http://0.0.0.0:8001 ``` -------------------------------- ### Example Usage: Start OpenHands with Local Runtime in Headless Mode Source: https://docs.all-hands.dev/usage/runtimes/local This example demonstrates how to launch OpenHands using the Local Runtime in headless mode. It sets the RUNTIME and SANDBOX_VOLUMES environment variables, then executes the OpenHands main script with a specific task, showcasing a practical application of the Local Runtime for agent operations. ```bash export RUNTIME=local export SANDBOX_VOLUMES=/my_folder/myproject:/workspace:rw poetry run python -m openhands.core.main -t "write a bash script that prints hi" ``` -------------------------------- ### Dockerfile to Install Ruby via apt-get for OpenHands Sandbox Source: https://docs.all-hands.dev/usage/how-to/custom-sandbox-guide Example Dockerfile to extend the default `nikolaik/python-nodejs` base image by installing Ruby using `apt-get`, suitable for a custom OpenHands sandbox. ```dockerfile FROM nikolaik/python-nodejs:python3.12-nodejs22 # Install required packages RUN apt-get update && apt-get install -y ruby ``` -------------------------------- ### Start LiteLLM Proxy Server Source: https://docs.litellm.ai/docs/providers/vertex This command demonstrates how to start the LiteLLM proxy server using a specified configuration file. Ensure the `litellm` package is installed and the config file path is correct. ```Shell $ litellm --config /path/to/config.yaml ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/gemini Command-line instruction to start the LiteLLM proxy, referencing a custom configuration file. ```Bash $ litellm --config /path/to/config.yaml ``` -------------------------------- ### Start LiteLLM Proxy Server Source: https://docs.litellm.ai/docs/providers/gemini Command-line instruction to start the LiteLLM proxy server using a specified configuration file. ```shell $ litellm --config /path/to/config.yaml ``` -------------------------------- ### Run OpenHands Docker Container Source: https://docs.all-hands.dev/usage/local-setup This command sequence pulls the specified OpenHands runtime image and then launches the OpenHands application within a Docker container. It configures the sandbox runtime, enables event logging, mounts necessary volumes for Docker communication and state persistence, maps port 3000 for UI access, and ensures host.docker.internal resolution. ```bash docker pull docker.all-hands.dev/all-hands-ai/runtime:0.43-nikolaik docker run -it --rm --pull=always \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.43-nikolaik \ -e LOG_ALL_EVENTS=true \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/.openhands-state:/.openhands-state \ -p 3000:3000 \ --add-host host.docker.internal:host-gateway \ --name openhands-app \ docker.all-hands.dev/all-hands-ai/openhands:0.43 ``` -------------------------------- ### Start LiteLLM Proxy with a HuggingFace Model Source: https://docs.litellm.ai/docs/proxy/quick_start Runs the LiteLLM proxy, routing requests to a specified HuggingFace model (e.g., bigcode/starcoder). The proxy will be accessible on http://0.0.0.0:4000. ```Shell litellm --model huggingface/bigcode/starcoder ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/openai Command-line instruction to start the LiteLLM proxy server, loading the specified configuration file. This enables the proxy to handle requests based on the defined model settings. ```shell litellm --config config.yaml ``` -------------------------------- ### Good Prompt Examples for OpenHands Source: https://docs.all-hands.dev/usage/prompting/prompting-best-practices Examples of well-structured and effective prompts for the OpenHands AI software developer, demonstrating concreteness, location-specificity, and appropriate scope. ```Prompt Add a function `calculate_average` in `utils/math_operations.py` that takes a list of numbers as input and returns their average. ``` ```Prompt Fix the TypeError in `frontend/src/components/UserProfile.tsx` occurring on line 42. The error suggests we're trying to access a property of undefined. ``` ```Prompt Implement input validation for the email field in the registration form. Update `frontend/src/components/RegistrationForm.tsx` to check if the email is in a valid format before submission. ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/groq A command-line instruction to start the LiteLLM proxy, directing it to load its configuration from a specified `config.yaml` file. This enables the proxy to serve configured models, including Groq models. ```Shell litellm --config config.yaml ``` -------------------------------- ### LiteLLM Proxy: Start Proxy Server with Configuration Source: https://docs.litellm.ai/docs/providers/gemini Command to start the LiteLLM proxy server using a specified configuration file. ```shell litellm --config /path/to/config.yaml ``` -------------------------------- ### Start New Conversation with OpenHands Cloud API using Python Source: https://www.all-hands.dev/blog This Python example demonstrates how to initiate a new conversation with an AI software development agent via the OpenHands Cloud API. It sends an initial user message and repository context, then prints the link to the new conversation. This requires the 'requests' library. ```Python import requests api_key = "YOUR_API_KEY" url = "https://app.all-hands.dev/api/conversations" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } data = { "initial_user_msg": "Check for the authentication module to make sure that it follows the coding best practices for this repo.", "repository": "https://github.com/yourusername/your-repo" } response = requests.post(url, headers=headers, json=data) conversation = response.json() print(f"Conversation Link: https://app.all-hands.dev/conversations/{conversation['conversation_id']}") ``` -------------------------------- ### Example OpenHands Command Line Execution Source: https://docs.all-hands.dev/usage/how-to/evaluation-harness This example provides a concrete demonstration of how to run OpenHands from the command line. It shows specific values for maximum iterations, a task description, the `CodeActAgent`, and the default `llm` configuration, providing a practical illustration of the command's usage. ```bash poetry run python ./openhands/core/main.py \ -i 10 \ -t "Write me a bash script that prints hello world." \ -c CodeActAgent \ -l llm ``` -------------------------------- ### Install Websocat Command-Line Tool (Bash) Source: https://docs.all-hands.dev/usage/how-to/websocket-connection These commands provide instructions for installing Websocat, a command-line tool for WebSocket interaction, on both macOS using Homebrew and Linux by downloading and installing the binary. Websocat is useful for testing WebSocket connections without a full client. ```bash # On macOS brew install websocat # On Linux curl -L https://github.com/vi/websocat/releases/download/v1.11.0/websocat.x86_64-unknown-linux-musl > websocat chmod +x websocat sudo mv websocat /usr/local/bin/ ``` -------------------------------- ### Example Repository Structure for Microagents Source: https://docs.all-hands.dev/usage/prompting/microagents-overview This snippet illustrates the recommended directory structure for organizing microagent files within an OpenHands project repository. It shows the placement of the .openhands/microagents/ directory and examples of repo.md for general guidelines and other .md files for keyword-triggered microagents. ```plaintext some-repository/ └── .openhands/ └── microagents/ └── repo.md # General guidelines └── trigger_this.md # Microagent triggered by specific keywords └── trigger_that.md # Microagent triggered by specific keywords ``` -------------------------------- ### Start LiteLLM Proxy Server (CLI) Source: https://docs.litellm.ai/docs/providers/openai This command starts the LiteLLM Proxy Server, making it available to handle requests for the specified model or models configured in `config.yaml`. ```Shell $ litellm --model gpt-3.5-turbo ``` -------------------------------- ### Start LiteLLM Proxy from Configuration File Source: https://docs.litellm.ai/docs/providers/vertex Command-line instruction to start the LiteLLM proxy server, loading its configuration from a specified YAML file. ```shell litellm --config /path/to/config.yaml ``` -------------------------------- ### LiteLLM Proxy Request with `reasoning_effort` Source: https://docs.litellm.ai/docs/providers/vertex This section outlines the steps to configure and use the LiteLLM proxy to send requests with the `reasoning_effort` parameter. It includes a `config.yaml` example, the command to start the proxy, and a cURL command to test the setup. ```yaml - model_name: gemini-2.5-flash litellm_params: model: vertex_ai/gemini-2.5-flash-preview-04-17 vertex_credentials: {"project_id": "project-id", "location": "us-central1", "project_key": "project-key"} vertex_project: "project-id" vertex_location: "us-central1" ``` ```shell litellm --config /path/to/config.yaml ``` ```curl curl http://0.0.0.0:4000/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "model": "gemini-2.5-flash", "messages": [{"role": "user", "content": "What is the capital of France?"}], "reasoning_effort": "low" }' ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/azure Command-line instruction to start the LiteLLM proxy, pointing it to a specific configuration file for model definitions. ```Shell litellm --config /path/to/config.yaml ``` -------------------------------- ### Start LiteLLM Proxy with a Configuration File Source: https://docs.litellm.ai/docs/providers/vertex This Bash command demonstrates how to start the LiteLLM proxy server, instructing it to load its configuration from a specified YAML file. ```Bash litellm --config /path/to/config.yaml ``` -------------------------------- ### OpenAPI Specification for Get User Repositories Source: https://docs.all-hands.dev/api-reference/get-user-repositories Defines the OpenAPI specification for the GET /api/user/repositories endpoint. It includes server URLs, security requirements (bearerAuth), query parameters (sort), and detailed response schemas for 200, 401, and 500 status codes, along with examples. ```yaml paths: path: /api/user/repositories method: get servers: - url: https://app.all-hands.dev description: Production server - url: http://localhost:3000 description: Local development server request: security: - title: bearerAuth parameters: query: {} header: Authorization: type: http scheme: bearer cookie: {} parameters: path: {} query: sort: schema: - type: string required: false description: Sort order for repositories default: pushed header: {} cookie: {} body: {} response: '200': application/json: schemaArray: - type: array items: allOf: - type: object properties: full_name: type: string description: type: string nullable: true html_url: type: string private: type: boolean fork: type: boolean updated_at: type: string format: date-time examples: example: value: - full_name: description: html_url: private: true fork: true updated_at: '2023-11-07T05:31:56Z' description: User repositories '401': application/json: schemaArray: - type: string examples: example: value: description: Authentication error '500': application/json: schemaArray: - type: string examples: example: value: description: Unknown error deprecated: false type: path components: schemas: {} ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/vertex Command to start the LiteLLM proxy server using a specified configuration file. The proxy will run on `http://0.0.0.0:4000`. ```Bash litellm --config /path/to/config.yaml# RUNNING at http://0.0.0.0:4000 ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/vertex Provides the command to start the LiteLLM proxy server, loading the model configurations from a specified YAML file. ```bash litellm --config /path/to/config.yaml ``` -------------------------------- ### Generate Basic Bash Hello World Script Source: https://docs.all-hands.dev/usage/getting-started Instructs the agent to create a simple bash script that outputs 'hello world!' and verifies its execution. ```bash Write a bash script hello.sh that prints "hello world!" ``` -------------------------------- ### Example Organization Microagent Guidelines Source: https://docs.all-hands.dev/usage/prompting/microagents-org This snippet provides an example of general guidelines that can be defined within an organization-level microagent file. These guidelines are applied across all repositories belonging to the organization or user and are typically stored in a `.openhands/microagents` directory within a `.openhands` repository. ```Markdown * Use type hints and error boundaries; validate inputs at system boundaries and fail with meaningful error messages. * Document interfaces and public APIs; use implementation comments only for non-obvious logic. * Follow the same naming convention for variables, classes, constants, etc. already used in each repository. ``` -------------------------------- ### Bad Prompt Examples for OpenHands Source: https://docs.all-hands.dev/usage/prompting/prompting-best-practices Examples of ineffective prompts for the OpenHands AI software developer, illustrating common pitfalls such as vagueness, overly broad scope, and lack of specific details. ```Prompt Make the code better. (Too vague, not concrete) ``` ```Prompt Rewrite the entire backend to use a different framework. (Not appropriately scoped) ``` ```Prompt There's a bug somewhere in the user authentication. Can you find and fix it? (Lacks specificity and location information) ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/vertex Shows the command to start the LiteLLM proxy server, pointing it to a specified configuration file. The proxy will then be accessible at the indicated local address. ```Shell litellm --config /path/to/config.yaml # RUNNING at http://0.0.0.0:4000 ``` -------------------------------- ### Run LiteLLM with OpenAI Source: https://docs.litellm.ai/docs/proxy/quick_start This snippet illustrates how to set the `OPENAI_API_KEY` environment variable and then use `litellm` to make a request to a standard OpenAI model like `gpt-3.5-turbo`. ```bash export OPENAI_API_KEY=my-api-key litellm --model gpt-3.5-turbo ``` -------------------------------- ### OpenAPI Specification for Get Runtime Hosts API Source: https://docs.all-hands.dev/api-reference/get-runtime-hosts This OpenAPI specification defines the `GET /api/conversations/{conversation_id}/web-hosts` endpoint. It details the path parameters, security requirements (bearer token), and the expected 200 (success) and 500 (error) responses, including their schemas and example values. The endpoint retrieves a list of hosts used by the runtime for a given conversation ID. ```yaml paths: path: /api/conversations/{conversation_id}/web-hosts method: get servers: - url: https://app.all-hands.dev description: Production server - url: http://localhost:3000 description: Local development server request: security: - title: bearerAuth parameters: query: {} header: Authorization: type: http scheme: bearer cookie: {} parameters: path: conversation_id: schema: - type: string required: true description: Conversation ID query: {} header: {} cookie: {} body: {} response: '200': application/json: schemaArray: - type: object properties: hosts: allOf: - type: array items: type: string examples: example: value: hosts: - description: Runtime hosts '500': application/json: schemaArray: - type: object properties: hosts: allOf: - type: array items: type: string nullable: true error: allOf: - type: string examples: example: value: hosts: - error: description: Error getting runtime hosts deprecated: false type: path components: schemas: {} ``` -------------------------------- ### Start LiteLLM Proxy with Configuration Source: https://docs.litellm.ai/docs/providers/vertex Command-line instruction to start the LiteLLM Proxy, pointing it to a specific configuration file. This activates the proxy for handling API requests. ```Shell $ litellm --config /path/to/config.yaml ``` -------------------------------- ### Start LiteLLM Proxy Server with Configuration Source: https://docs.litellm.ai/docs/providers/vertex Provides the command-line instruction to start the LiteLLM Proxy server, loading the specified configuration file. This makes the configured models accessible via the proxy endpoint. ```Shell $ litellm --config /path/to/config.yaml ``` -------------------------------- ### SANDBOX_VOLUMES Common Usage Examples Source: https://docs.all-hands.dev/usage/runtimes/docker This section provides practical examples for using `SANDBOX_VOLUMES` across different operating systems and scenarios. It covers writable workspaces for Linux/Mac and WSL, read-only reference code, and a combination of writable workspace with read-only data mounts. ```bash # Linux and Mac Example - Writable workspace export SANDBOX_VOLUMES=$HOME/OpenHands:/workspace:rw # WSL on Windows Example - Writable workspace export SANDBOX_VOLUMES=/mnt/c/dev/OpenHands:/workspace:rw # Read-only reference code example export SANDBOX_VOLUMES=/path/to/reference/code:/data:ro # Multiple mounts example - Writable workspace with read-only reference data export SANDBOX_VOLUMES=$HOME/projects:/workspace:rw,/path/to/large/dataset:/data:ro ``` -------------------------------- ### Run LiteLLM with Cohere Source: https://docs.litellm.ai/docs/proxy/quick_start This snippet shows how to set the `COHERE_API_KEY` environment variable and then use `litellm` to interact with a Cohere model, such as `command-nightly`. ```bash export COHERE_API_KEY=my-api-key litellm --model command-nightly ``` -------------------------------- ### Start LiteLLM Proxy with Configuration File Source: https://docs.litellm.ai/docs/providers/vertex Provides the command to start the LiteLLM proxy server using a specified configuration file. It indicates the default running address of the proxy. ```bash litellm --config /path/to/config.yaml # RUNNING at http://0.0.0.0:4000 ``` -------------------------------- ### Retrieve Conversation Status with cURL Source: https://docs.all-hands.dev/usage/cloud/cloud-api Example cURL command to send a GET request to retrieve the status of a specific conversation using its ID and API key. ```bash curl -X GET "https://app.all-hands.dev/api/conversations/{conversation_id}" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Start LiteLLM Proxy Server from Configuration Source: https://docs.litellm.ai/docs/providers/gemini Provides the command-line instruction to launch the LiteLLM proxy server. This command requires a path to a valid `config.yaml` file, enabling the proxy to serve configured models. ```bash litellm --config /path/to/config.yaml ``` -------------------------------- ### Run LiteLLM with Replicate Source: https://docs.litellm.ai/docs/proxy/quick_start This snippet demonstrates how to set the `REPLICATE_API_KEY` environment variable and then use `litellm` to interact with a specific model on Replicate, such as Llama-2-70b-chat. ```bash export REPLICATE_API_KEY=my-api-key litellm \ --model replicate/meta/llama-2-70b-chat:02e509c789964a7ea8736978a43525956ef40397be9033abf9fd2badfe68c9e3 ``` -------------------------------- ### LiteLLM SDK Request with `reasoning_effort` Source: https://docs.litellm.ai/docs/providers/vertex This Python SDK example demonstrates how to make a LiteLLM completion call to a Vertex AI Gemini model, specifying the `reasoning_effort` parameter. It includes environment setup notes. ```python from litellm import completion # !gcloud auth application-default login - run this to add vertex credentials to your env resp = completion( model="vertex_ai/gemini-2.5-flash-preview-04-17", messages=[{"role": "user", "content": "What is the capital of France?"}], reasoning_effort="low", vertex_project="project-id", vertex_location="us-central1") ``` -------------------------------- ### Run LiteLLM with VLLM Source: https://docs.litellm.ai/docs/proxy/quick_start This snippet shows how to use `litellm` to connect to a VLLM instance, assuming VLLM is running locally. It specifies a Facebook OPT-125m model. ```bash litellm --model vllm/facebook/opt-125m ``` -------------------------------- ### Make Chat Completions Request with Curl to LiteLLM Proxy Source: https://docs.litellm.ai/docs/proxy/quick_start Illustrates how to send a chat completions request to the LiteLLM proxy using a direct Curl command. This example sends a simple user message to the `gpt-3.5-turbo` model running on the proxy. ```curl curl --location 'http://0.0.0.0:4000/chat/completions' \--header 'Content-Type: application/json' \--data ' { "model": "gpt-3.5-turbo", "messages": [ { "role": "user", "content": "what llm are you" } ] }' ``` -------------------------------- ### Generate Embeddings with Langchain Embeddings to LiteLLM Proxy Source: https://docs.litellm.ai/docs/proxy/quick_start Illustrates how to use Langchain's `OpenAIEmbeddings` to generate text embeddings via the LiteLLM proxy. Examples are provided for different embedding models like `sagemaker-embeddings`, `bedrock-embeddings`, and `bedrock-titan-embeddings`, all routed through the proxy. ```python from langchain.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings(model="sagemaker-embeddings", openai_api_base="http://0.0.0.0:4000", openai_api_key="temp-key") text = "This is a test document." query_result = embeddings.embed_query(text) print(f"SAGEMAKER EMBEDDINGS") print(query_result[:5]) embeddings = OpenAIEmbeddings(model="bedrock-embeddings", openai_api_base="http://0.0.0.0:4000", openai_api_key="temp-key") text = "This is a test document." query_result = embeddings.embed_query(text) print(f"BEDROCK EMBEDDINGS") print(query_result[:5]) embeddings = OpenAIEmbeddings(model="bedrock-titan-embeddings", openai_api_base="http://0.0.0.0:4000", openai_api_key="temp-key") text = "This is a test document." query_result = embeddings.embed_query(text) print(f"TITAN EMBEDDINGS") print(query_result[:5]) ``` -------------------------------- ### Convert Bash Script to Ruby Source: https://docs.all-hands.dev/usage/getting-started Requests the agent to translate the 'hello.sh' functionality into a Ruby script and execute it. ```ruby Please convert hello.sh to a Ruby script, and run it ``` -------------------------------- ### Perform OpenAI Audio Transcription with LiteLLM SDK Source: https://docs.litellm.ai/docs/providers/openai Provides a Python example demonstrating how to use the LiteLLM `transcription` function to transcribe an audio file. It shows the necessary imports, API key setup, and the function call with model and file parameters. ```python from litellm import transcription import os # set api keys os.environ["OPENAI_API_KEY"] = "" audio_file = open("/path/to/audio.mp3", "rb") response = transcription(model="gpt-4o-transcribe", file=audio_file) print(f"response: {response}") ``` -------------------------------- ### Run LiteLLM with AWS Sagemaker Source: https://docs.litellm.ai/docs/proxy/quick_start This snippet outlines how to set AWS credentials for Sagemaker integration and then use `litellm` to interact with a specific Jumpstart model, such as Llama-2-7b. ```bash export AWS_ACCESS_KEY_ID= export AWS_REGION_NAME= export AWS_SECRET_ACCESS_KEY= litellm --model sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b ``` -------------------------------- ### OpenAPI Specification for Search Repositories API Source: https://docs.all-hands.dev/api-reference/search-repositories This snippet defines the OpenAPI specification for the `/api/user/search/repositories` GET endpoint. It details the request parameters (query, per_page, sort, order), security requirements (bearerAuth), and possible responses (200, 401, 500) including their schemas and examples. ```APIDOC paths: path: /api/user/search/repositories method: get servers: - url: https://app.all-hands.dev description: Production server - url: http://localhost:3000 description: Local development server request: security: - title: bearerAuth parameters: query: {} header: Authorization: type: http scheme: bearer cookie: {} parameters: path: {} query: query: schema: - type: string required: true description: Search query per_page: schema: - type: integer required: false description: Number of repositories to return per page default: 5 sort: schema: - type: string required: false description: Sort order for repositories default: stars order: schema: - type: string required: false description: Sort direction default: desc header: {} cookie: {} body: {} response: '200': application/json: schemaArray: - type: array items: allOf: - type: object properties: full_name: type: string description: type: string nullable: true html_url: type: string private: type: boolean fork: type: boolean updated_at: type: string format: date-time examples: example: value: - full_name: description: html_url: private: true fork: true updated_at: '2023-11-07T05:31:56Z' description: Search results '401': application/json: schemaArray: - type: string examples: example: value: description: Authentication error '500': application/json: schemaArray: - type: string examples: example: value: description: Unknown error deprecated: false type: path components: schemas: {} ``` -------------------------------- ### Send JSON Response Schema with LiteLLM SDK Source: https://docs.litellm.ai/docs/providers/vertex Demonstrates how to use the LiteLLM Python SDK to send a JSON response schema as a parameter to the `completion` function. This example targets Gemini-1.5-Pro on Vertex AI and includes necessary environment setup for authentication. ```Python from litellm import completion import json ## SETUP ENVIRONMENT # !gcloud auth application-default login - run this to add vertex credentials to your env messages = [ { "role": "user", "content": "List 5 popular cookie recipes." } ] response_schema = { "type": "array", "items": { "type": "object", "properties": { "recipe_name": { "type": "string", }, }, "required": ["recipe_name"], }, } completion( model="vertex_ai/gemini-1.5-pro", messages=messages, response_format={"type": "json_object", "response_schema": response_schema} # 👈 KEY CHANGE ) print(json.loads(completion.choices[0].message.content)) ``` -------------------------------- ### Run LiteLLM with OpenAI Compatible Endpoint Source: https://docs.litellm.ai/docs/proxy/quick_start This snippet shows how to connect LiteLLM to any OpenAI-compatible API endpoint. It requires setting an `OPENAI_API_KEY` and specifying the custom API base URL using the `--api_base` flag. ```bash export OPENAI_API_KEY=my-api-key litellm --model openai/ --api_base # e.g. http://0.0.0.0:3000 ``` -------------------------------- ### OpenAPI Specification for Health Check Endpoint Source: https://docs.all-hands.dev/api-reference/health-check Defines the /health GET endpoint for API status checks, including server URLs for production and local development, security requirements (bearerAuth), and a 200 OK response with a 'OK' string example. This specification can be used to generate API clients or documentation. ```yaml paths: path: /health method: get servers: - url: https://app.all-hands.dev description: Production server - url: http://localhost:3000 description: Local development server request: security: - title: bearerAuth parameters: query: {} header: Authorization: type: http scheme: bearer cookie: {} parameters: path: {} query: {} header: {} cookie: {} body: {} response: '200': text/plain: schemaArray: - type: string example: OK examples: example: value: OK description: API is running deprecated: false type: path components: schemas: {} ``` -------------------------------- ### AI Agent Prompt for Bug Fixing Workflow Source: https://www.all-hands.dev/blog This prompt guides an AI agent through a seven-step process to identify, reproduce, fix, and deploy a software bug. It emphasizes environment setup, test-driven development (TDD), iterative implementation, and automated CI/CD checks via the GitHub API. ```Natural Language I found a bug in our web app. Here are the details: 1. Explore the codebase to find the place where the bug is located 2. Install the project dependencies using `INSTALL_DOCKER=0 make build` 3. Write a test to reproduce the bug 4. Run tests according to the `py-unit-tests.yml` github workflow to make sure that this newly written test fails as expected 5. Fix the bug, and re-run tests to confirm that the tests now pass 6. If everything is working and you are confident you fixed the error, send a PR to the GitHub repo 7. Wait 90 seconds and then use the GitHub API to check if github actions are passing. If not, fix the errors ``` -------------------------------- ### Start LiteLLM Proxy Server with Configuration Source: https://docs.litellm.ai/docs/providers/openai This command initializes the LiteLLM proxy server, instructing it to load settings from the specified `config.yaml` file. The `--detailed_debug` flag enables verbose logging, which is useful for verifying the forwarding of the organization ID. The proxy will be accessible at `http://0.0.0.0:4000`. ```bash litellm --config config.yaml --detailed_debug ``` -------------------------------- ### Prompt for AI Agent to Set Up New Repository with Best Practices Source: https://www.all-hands.dev/blog This Markdown prompt guides an AI agent to set up a new repository with a Python backend and TypeScript frontend, incorporating essential best practices. These include mypy for type checking, ruff for linting, pre-commit hooks, and GitHub Actions for CI/CD, ensuring a robust project foundation. ```md Set up a new repo with a Python backend and TypeScript frontend. Use best practices, including mypy for type checking, ruff for linting, pre-commit hooks, and github actions for CI/CD. ``` -------------------------------- ### Prompting OpenHands for Automated Bug Fixing Source: https://www.all-hands.dev/blog A detailed prompt guiding the OpenHands agent through the process of diagnosing and resolving a software bug. The instructions include using the GitHub API to read an issue, exploring the codebase, installing dependencies, writing and running a failing test, and finally implementing and verifying the fix. ```Prompt Please use the github API to read this issue: https://github.com/All-Hands-AI/OpenHands/issues/4480 Diagnose the problem, and fix it according to the following procedure: 1. Explore the codebase to find a likely location where the problem is occurring 2. Install the project dependencies using `INSTALL_DOCKER=0 make build` 3. Write a test that should fail if the problem is not addressed 4. Run tests according to the `py-unit-tests.yml` github workflow to make sure that this newly written test fails as expected 5. Fix the issue, and re-run tests to confirm that the ``` -------------------------------- ### Build Frontend React TODO App with LocalStorage Source: https://docs.all-hands.dev/usage/getting-started Instructs the agent to create a new React-based TODO application where all application state is persisted in localStorage. ```react Build a frontend-only TODO app in React. All state should be stored in localStorage. ``` -------------------------------- ### Provide URL Context to Gemini Models Source: https://docs.litellm.ai/docs/providers/vertex This section illustrates how to use the URL context tool to provide Gemini models with URLs as additional context. The model can then retrieve content from these URLs to inform its response. It includes examples for LiteLLM SDK/Proxy, configuration setup for the proxy, and a cURL request. URL context metadata can be accessed via `response.model_extra['vertex_ai_url_context_metadata']`. ```python from litellm import completion import os os.environ["GEMINI_API_KEY"] = ".." # 👇 ADD URL CONTEXT tools = [{"urlContext": {}}] response = completion( model="gemini/gemini-2.0-flash", messages=[{"role": "user", "content": "Summarize this document: https://ai.google.dev/gemini-api/docs/models"}], tools=tools, ) print(response) # Access URL context metadata url_context_metadata = response.model_extra['vertex_ai_url_context_metadata'] urlMetadata = url_context_metadata[0]['urlMetadata'][0] print(f"Retrieved URL: {urlMetadata['retrievedUrl']}") print(f"Retrieval Status: {urlMetadata['urlRetrievalStatus']}") ``` ```yaml model_list: - model_name: gemini-2.0-flash litellm_params: model: gemini/gemini-2.0-flash api_key: os.environ/GEMINI_API_KEY ``` ```bash $ litellm --config /path/to/config.yaml ``` ```bash curl -X POST 'http://0.0.0.0:4000/chat/completions' \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "model": "gemini-2.0-flash", "messages": [{"role": "user", "content": "Summarize this document: https://ai.google.dev/gemini-api/docs/models"}], "tools": [{"urlContext": {}}] }' ``` -------------------------------- ### Get a Benchmark. Source: https://docs.runloop.ai/overview/what-is-runloop Get a previously created Benchmark. ```APIDOC Method: GET /v1/benchmarks/{id} Title: Get a Benchmark. Description: Get a previously created Benchmark. ``` -------------------------------- ### Get a previously created BenchmarkRun. Source: https://docs.runloop.ai/overview/what-is-runloop Get a BenchmarkRun given ID. ```APIDOC Method: GET /v1/benchmarks/runs/{id} Title: Get a previously created BenchmarkRun. Description: Get a BenchmarkRun given ID. ``` -------------------------------- ### Modify Bash Script for Argument Handling Source: https://docs.all-hands.dev/usage/getting-started Refines the 'hello.sh' script to accept an optional name argument, defaulting to 'world' if not provided. ```bash Modify hello.sh so that it accepts a name as the first argument, but defaults to "world" ``` -------------------------------- ### OpenAPI Specification for Get Config Endpoint Source: https://docs.all-hands.dev/api-reference/get-config This OpenAPI specification defines the `/api/options/config` GET endpoint. It details the request parameters, security requirements (bearer token), server definitions, and the expected 200 OK response, which returns the server configuration. ```APIDOC paths: path: /api/options/config method: get servers: - url: https://app.all-hands.dev description: Production server - url: http://localhost:3000 description: Local development server request: security: - title: bearerAuth parameters: query: {} header: Authorization: type: http scheme: bearer cookie: {} parameters: path: {} query: {} header: {} cookie: {} body: {} response: '200': application/json: schemaArray: - type: object properties: {} examples: example: value: {} description: Server configuration deprecated: false type: path components: schemas: {} ``` -------------------------------- ### Start a new BenchmarkRun. Source: https://docs.runloop.ai/overview/what-is-runloop Start a new BenchmarkRun based on the provided Benchmark. ```APIDOC Method: POST /v1/benchmarks/start_run Title: Start a new BenchmarkRun. Description: Start a new BenchmarkRun based on the provided Benchmark. ``` -------------------------------- ### Start LiteLLM Proxy with Custom Configuration Source: https://docs.litellm.ai/docs/providers/gemini Command-line instruction to initiate the LiteLLM proxy server, loading a specified configuration file. This is necessary after setting up the `config.yaml` for TTS models. ```Shell litellm --config /path/to/config.yaml ``` -------------------------------- ### OpenHands Benchmark Folder Structure Example Source: https://github.com/All-Hands-AI/OpenHands/tree/main/evaluation This path illustrates the recommended subfolder structure for a specific benchmark or experiment within the OpenHands evaluation repository. It indicates the location where all preprocessing, evaluation, and analysis scripts pertinent to that benchmark should be stored. ```File Path evaluation/benchmarks/swe_bench ``` -------------------------------- ### Get scenario definitions for a Benchmark. Source: https://docs.runloop.ai/overview/what-is-runloop Get scenario definitions for a previously created Benchmark. ```APIDOC Method: GET /v1/benchmarks/{id}/definitions Title: Get scenario definitions for a Benchmark. Description: Get scenario definitions for a previously created Benchmark. ``` -------------------------------- ### Install OpenHands with pip Source: https://docs.all-hands.dev/usage/how-to/cli-mode Installs the OpenHands AI package using pip, making the OpenHands CLI available on your system. ```bash pip install openhands-ai ``` -------------------------------- ### Test LiteLLM Proxy Configuration Source: https://docs.litellm.ai/docs/proxy/quick_start Executes a test request against the running LiteLLM proxy, simulating an openai.chat.completions call. Requires openai v1.0.0+. ```Shell litellm --test ``` -------------------------------- ### List started scenario runs for a benchmark run. Source: https://docs.runloop.ai/overview/what-is-runloop List started scenario runs for a benchmark run. ```APIDOC Method: GET /v1/benchmarks/runs/{id}/scenario_runs Title: List started scenario runs for a benchmark run. Description: List started scenario runs for a benchmark run. ``` -------------------------------- ### Refactor PHP: Split Function into Two Source: https://docs.all-hands.dev/usage/getting-started Requests the agent to refactor the 'widget.php' file by splitting the 'build_and_deploy_widgets' function into two distinct functions: 'build_widgets' and 'deploy_widgets'. ```php Split the `build_and_deploy_widgets` function into two functions, `build_widgets` and `deploy_widgets` in widget.php. ```