From 5fb0eec61eb1991fccb8ee74cee62fa5aaf4c76b Mon Sep 17 00:00:00 2001 From: mamoodi Date: Fri, 20 Dec 2024 15:59:13 -0500 Subject: [PATCH] Fix resolver workflow and update docs (#5713) --- .github/workflows/openhands-resolver.yml | 10 ++++---- docs/modules/usage/how-to/github-action.md | 23 +++++++++++-------- .../resolver/examples/openhands-resolver.yml | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/openhands-resolver.yml b/.github/workflows/openhands-resolver.yml index 3b09994fd6..8356471f4f 100644 --- a/.github/workflows/openhands-resolver.yml +++ b/.github/workflows/openhands-resolver.yml @@ -116,7 +116,7 @@ jobs: PAT_USERNAME: ${{ secrets.PAT_USERNAME }} GITHUB_TOKEN: ${{ github.token }} run: | - required_vars=("LLM_MODEL" "LLM_API_KEY") + required_vars=("LLM_API_KEY") for var in "${required_vars[@]}"; do if [ -z "${!var}" ]; then echo "Error: Required environment variable $var is not set." @@ -125,14 +125,14 @@ jobs: done # Check optional variables and warn about fallbacks - if [ -z "$PAT_TOKEN" ]; then - echo "Warning: PAT_TOKEN is not set, falling back to GITHUB_TOKEN" - fi - if [ -z "$LLM_BASE_URL" ]; then echo "Warning: LLM_BASE_URL is not set, will use default API endpoint" fi + if [ -z "$PAT_TOKEN" ]; then + echo "Warning: PAT_TOKEN is not set, falling back to GITHUB_TOKEN" + fi + if [ -z "$PAT_USERNAME" ]; then echo "Warning: PAT_USERNAME is not set, will use openhands-agent" fi diff --git a/docs/modules/usage/how-to/github-action.md b/docs/modules/usage/how-to/github-action.md index dff627cd9d..efcdd7bd90 100644 --- a/docs/modules/usage/how-to/github-action.md +++ b/docs/modules/usage/how-to/github-action.md @@ -39,23 +39,28 @@ You can provide custom directions for OpenHands by following the [README for the ### Custom configurations -Github resolver will automatically check for valid [repository secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions?tool=webui#creating-secrets-for-a-repository) or [repository variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository) to customize its behavior. The customization options you can set are: +Github resolver will automatically check for valid [repository secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions?tool=webui#creating-secrets-for-a-repository) or [repository variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository) to customize its behavior. +The customization options you can set are: -| **Attribute name** | **Type** | **Purpose** | **Example** | -| -------------------------------- | -------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -| `OPENHANDS_MAX_ITER` | Variable | Set max limit for agent iterations | `OPENHANDS_MAX_ITER=10` | -| `OPENHANDS_MACRO` | Variable | Customize default macro for invoking the resolver | `OPENHANDS_MACRO=@resolveit` | -| `OPENHANDS_BASE_CONTAINER_IMAGE` | Variable | Custom Sandbox ([learn more](https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide)) | `OPENHANDS_BASE_CONTAINER_IMAGE="custom_image"` | +| **Attribute name** | **Type** | **Purpose** | **Example** | +|----------------------------------| -------- |-------------------------------------------------------------------------------------------------------------|------------------------------------------------------| +| `LLM_MODEL` | Variable | Set the LLM to use with OpenHands | `LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"` | +| `OPENHANDS_MAX_ITER` | Variable | Set max limit for agent iterations | `OPENHANDS_MAX_ITER=10` | +| `OPENHANDS_MACRO` | Variable | Customize default macro for invoking the resolver | `OPENHANDS_MACRO=@resolveit` | +| `OPENHANDS_BASE_CONTAINER_IMAGE` | Variable | Custom Sandbox ([learn more](https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide)) | `OPENHANDS_BASE_CONTAINER_IMAGE="custom_image"` | ## Writing Effective .openhands_instructions Files -The `.openhands_instructions` file is a file that you can put in the root directory of your repository to guide OpenHands in understanding and working with your repository effectively. Here are key tips for writing high-quality instructions: +The `.openhands_instructions` file is a file that you can put in the root directory of your repository to guide OpenHands +in understanding and working with your repository effectively. Here are key tips for writing high-quality instructions: ### Core Principles -1. **Concise but Informative**: Provide a clear, focused overview of the repository that emphasizes the most common actions OpenHands will need to perform. +1. **Concise but Informative**: Provide a clear, focused overview of the repository that emphasizes the most common + actions OpenHands will need to perform. -2. **Repository Structure**: Explain the key directories and their purposes, especially highlighting where different types of code (e.g., frontend, backend) are located. +2. **Repository Structure**: Explain the key directories and their purposes, especially highlighting where different + types of code (e.g., frontend, backend) are located. 3. **Development Workflows**: Document the essential commands for: diff --git a/openhands/resolver/examples/openhands-resolver.yml b/openhands/resolver/examples/openhands-resolver.yml index 9507568015..8ebb451ca0 100644 --- a/openhands/resolver/examples/openhands-resolver.yml +++ b/openhands/resolver/examples/openhands-resolver.yml @@ -24,7 +24,7 @@ jobs: macro: ${{ vars.OPENHANDS_MACRO || '@openhands-agent' }} max_iterations: ${{ fromJson(vars.OPENHANDS_MAX_ITER || 50) }} base_container_image: ${{ vars.OPENHANDS_BASE_CONTAINER_IMAGE || '' }} - LLM_MODEL: ${{ vars.LLM_MODEL }} + LLM_MODEL: ${{ vars.LLM_MODEL || 'anthropic/claude-3-5-sonnet-20241022' }} secrets: PAT_TOKEN: ${{ secrets.PAT_TOKEN }} PAT_USERNAME: ${{ secrets.PAT_USERNAME }}