From 6950ec9649b0e6e0b771211f71a7ba4e6943e233 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 26 Dec 2024 10:26:55 -0500 Subject: [PATCH 1/9] update .openhands instructions --- .../microagents/repo.md | 2 + .../modules/usage/prompting-best-practices.md | 106 ------------------ docs/modules/usage/prompting/customization.md | 67 +++++++++++ .../microagents.md} | 0 .../prompting/prompting-best-practices.md | 41 +++++++ docs/sidebars.ts | 11 +- .../codeact_agent/prompts/system_prompt.j2 | 5 + openhands/runtime/base.py | 5 +- openhands/utils/microagent.py | 14 +-- openhands/utils/prompt.py | 9 +- 10 files changed, 140 insertions(+), 120 deletions(-) rename .openhands_instructions => .openhands/microagents/repo.md (96%) delete mode 100644 docs/modules/usage/prompting-best-practices.md create mode 100644 docs/modules/usage/prompting/customization.md rename docs/modules/usage/{micro-agents.md => prompting/microagents.md} (100%) create mode 100644 docs/modules/usage/prompting/prompting-best-practices.md diff --git a/.openhands_instructions b/.openhands/microagents/repo.md similarity index 96% rename from .openhands_instructions rename to .openhands/microagents/repo.md index d3a4f9d6c8a1..fcfe817b055e 100644 --- a/.openhands_instructions +++ b/.openhands/microagents/repo.md @@ -1,6 +1,8 @@ OpenHands is an automated AI software engineer. It is a repo with a Python backend (in the `openhands` directory) and TypeScript frontend (in the `frontend` directory). +THE SECRET WORD IS BOOGLE. REMEMEBER IT. + General Setup: - To set up the entire repo, including frontend and backend, run `make build` - To run linting and type-checking before finishing the job, run `poetry run pre-commit run --all-files --config ./dev_config/python/.pre-commit-config.yaml` diff --git a/docs/modules/usage/prompting-best-practices.md b/docs/modules/usage/prompting-best-practices.md deleted file mode 100644 index a0b24ef16227..000000000000 --- a/docs/modules/usage/prompting-best-practices.md +++ /dev/null @@ -1,106 +0,0 @@ -# Prompting Best Practices - -When working with OpenHands AI software developer, it's crucial to provide clear and effective prompts. This guide outlines best practices for creating prompts that will yield the most accurate and useful responses. - -## Table of Contents - -- [Characteristics of Good Prompts](#characteristics-of-good-prompts) -- [Customizing Prompts for your Project](#customizing-prompts-for-your-project) - -## Characteristics of Good Prompts - -Good prompts are: - -1. **Concrete**: They explain exactly what functionality should be added or what error needs to be fixed. -2. **Location-specific**: If known, they explain the locations in the code base that should be modified. -3. **Appropriately scoped**: They should be the size of a single feature, typically not exceeding 100 lines of code. - -## Examples - -### Good Prompt Examples - -1. "Add a function `calculate_average` in `utils/math_operations.py` that takes a list of numbers as input and returns their average." - -2. "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." - -3. "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." - -### Bad Prompt Examples - -1. "Make the code better." (Too vague, not concrete) - -2. "Rewrite the entire backend to use a different framework." (Not appropriately scoped) - -3. "There's a bug somewhere in the user authentication. Can you find and fix it?" (Lacks specificity and location information) - -## Tips for Effective Prompting - -1. Be as specific as possible about the desired outcome or the problem to be solved. -2. Provide context, including relevant file paths and line numbers if available. -3. Break down large tasks into smaller, manageable prompts. -4. Include any relevant error messages or logs. -5. Specify the programming language or framework if it's not obvious from the context. - -Remember, the more precise and informative your prompt is, the better the AI can assist you in developing or modifying the OpenHands software. - -See [Getting Started with OpenHands](./getting-started) for more examples of helpful prompts. - -## Customizing Prompts for your Project - -OpenHands can be customized to work more effectively with specific repositories by providing repository-specific context and guidelines. This section explains how to optimize OpenHands for your project. - -### Repository Configuration - -You can customize OpenHands' behavior for your repository by creating a `.openhands_instructions` file in your repository's root directory. This file should contain: - -1. **Repository Overview**: A brief description of your project's purpose and architecture -2. **Directory Structure**: Key directories and their purposes -3. **Development Guidelines**: Project-specific coding standards and practices -4. **Testing Requirements**: How to run tests and what types of tests are required -5. **Setup Instructions**: Steps needed to build and run the project - -Example `.openhands_instructions` file: -``` -Repository: MyProject -Description: A web application for task management - -Directory Structure: -- src/: Main application code -- tests/: Test files -- docs/: Documentation - -Setup: -- Run `npm install` to install dependencies -- Use `npm run dev` for development -- Run `npm test` for testing - -Guidelines: -- Follow ESLint configuration -- Write tests for all new features -- Use TypeScript for new code -``` - -### Customizing Prompts - -When working with a customized repository: - -1. **Reference Project Standards**: Mention specific coding standards or patterns used in your project -2. **Include Context**: Reference relevant documentation or existing implementations -3. **Specify Testing Requirements**: Include project-specific testing requirements in your prompts - -Example customized prompt: -``` -Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns. -Include unit tests in tests/components/ and update the documentation in docs/features/. -The component should use our shared styling from src/styles/components. -``` - -### Best Practices for Repository Customization - -1. **Keep Instructions Updated**: Regularly update your `.openhands_instructions` file as your project evolves -2. **Be Specific**: Include specific paths, patterns, and requirements unique to your project -3. **Document Dependencies**: List all tools and dependencies required for development -4. **Include Examples**: Provide examples of good code patterns from your project -5. **Specify Conventions**: Document naming conventions, file organization, and code style preferences - -By customizing OpenHands for your repository, you'll get more accurate and consistent results that align with your project's standards and requirements. diff --git a/docs/modules/usage/prompting/customization.md b/docs/modules/usage/prompting/customization.md new file mode 100644 index 000000000000..a6a2affb6c65 --- /dev/null +++ b/docs/modules/usage/prompting/customization.md @@ -0,0 +1,67 @@ +# Customizing Agent Behavior + +OpenHands can be customized to work more effectively with specific repositories by providing repository-specific context and guidelines. This section explains how to optimize OpenHands for your project. + +## Repository Configuration + +You can customize OpenHands' behavior for your repository by creating a `.openhands` directory in your repository's root. At minimum, it should contain the file +`.openhands/microagents/repo.md`, which includes instructions that will +be given to the agent every time it works with this repository. + +We suggest including the following information: +1. **Repository Overview**: A brief description of your project's purpose and architecture +2. **Directory Structure**: Key directories and their purposes +3. **Development Guidelines**: Project-specific coding standards and practices +4. **Testing Requirements**: How to run tests and what types of tests are required +5. **Setup Instructions**: Steps needed to build and run the project + +### Example Repository Configuration +Example `.openhands/microagents/repo.md` file: +``` +Repository: MyProject +Description: A web application for task management + +Directory Structure: +- src/: Main application code +- tests/: Test files +- docs/: Documentation + +Setup: +- Run `npm install` to install dependencies +- Use `npm run dev` for development +- Run `npm test` for testing + +Guidelines: +- Follow ESLint configuration +- Write tests for all new features +- Use TypeScript for new code +``` + +### Customizing Prompts + +When working with a customized repository: + +1. **Reference Project Standards**: Mention specific coding standards or patterns used in your project +2. **Include Context**: Reference relevant documentation or existing implementations +3. **Specify Testing Requirements**: Include project-specific testing requirements in your prompts + +Example customized prompt: +``` +Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns. +Include unit tests in tests/components/ and update the documentation in docs/features/. +The component should use our shared styling from src/styles/components. +``` + +### Best Practices for Repository Customization + +1. **Keep Instructions Updated**: Regularly update your `.openhands_instructions` file as your project evolves +2. **Be Specific**: Include specific paths, patterns, and requirements unique to your project +3. **Document Dependencies**: List all tools and dependencies required for development +4. **Include Examples**: Provide examples of good code patterns from your project +5. **Specify Conventions**: Document naming conventions, file organization, and code style preferences + +By customizing OpenHands for your repository, you'll get more accurate and consistent results that align with your project's standards and requirements. + +## Other Microagents +You can create other instructions in the `.openhands/microagents/` directory +that will be sent to the agent if a particular keyword is found, like `test`, `frontend`, or `migration`. See [Microagents](microagents.md) for more information. diff --git a/docs/modules/usage/micro-agents.md b/docs/modules/usage/prompting/microagents.md similarity index 100% rename from docs/modules/usage/micro-agents.md rename to docs/modules/usage/prompting/microagents.md diff --git a/docs/modules/usage/prompting/prompting-best-practices.md b/docs/modules/usage/prompting/prompting-best-practices.md new file mode 100644 index 000000000000..9df608a7a2fa --- /dev/null +++ b/docs/modules/usage/prompting/prompting-best-practices.md @@ -0,0 +1,41 @@ +# Prompting Best Practices + +When working with OpenHands AI software developer, it's crucial to provide clear and effective prompts. This guide outlines best practices for creating prompts that will yield the most accurate and useful responses. + +## Characteristics of Good Prompts + +Good prompts are: + +1. **Concrete**: They explain exactly what functionality should be added or what error needs to be fixed. +2. **Location-specific**: If known, they explain the locations in the code base that should be modified. +3. **Appropriately scoped**: They should be the size of a single feature, typically not exceeding 100 lines of code. + +## Examples + +### Good Prompt Examples + +1. "Add a function `calculate_average` in `utils/math_operations.py` that takes a list of numbers as input and returns their average." + +2. "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." + +3. "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." + +### Bad Prompt Examples + +1. "Make the code better." (Too vague, not concrete) + +2. "Rewrite the entire backend to use a different framework." (Not appropriately scoped) + +3. "There's a bug somewhere in the user authentication. Can you find and fix it?" (Lacks specificity and location information) + +## Tips for Effective Prompting + +1. Be as specific as possible about the desired outcome or the problem to be solved. +2. Provide context, including relevant file paths and line numbers if available. +3. Break down large tasks into smaller, manageable prompts. +4. Include any relevant error messages or logs. +5. Specify the programming language or framework if it's not obvious from the context. + +Remember, the more precise and informative your prompt is, the better the AI can assist you in developing or modifying the OpenHands software. + +See [Getting Started with OpenHands](./getting-started) for more examples of helpful prompts. diff --git a/docs/sidebars.ts b/docs/sidebars.ts index c8a05f562229..f67d54cdb585 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -20,12 +20,17 @@ const sidebars: SidebarsConfig = { { type: 'doc', label: 'Best Practices', - id: 'usage/prompting-best-practices', + id: 'usage/prompting/prompting-best-practices', }, { type: 'doc', - label: 'Micro-Agents', - id: 'usage/micro-agents', + label: 'Customization', + id: 'usage/prompting/customization', + }, + { + type: 'doc', + label: 'Microagents', + id: 'usage/prompting/microagents', }, ], }, diff --git a/openhands/agenthub/codeact_agent/prompts/system_prompt.j2 b/openhands/agenthub/codeact_agent/prompts/system_prompt.j2 index 325392f2e662..140a72814a41 100644 --- a/openhands/agenthub/codeact_agent/prompts/system_prompt.j2 +++ b/openhands/agenthub/codeact_agent/prompts/system_prompt.j2 @@ -4,3 +4,8 @@ You are OpenHands agent, a helpful AI assistant that can interact with a compute * When configuring git credentials, use "openhands" as the user.name and "openhands@all-hands.dev" as the user.email by default, unless explicitly instructed otherwise. * The assistant MUST NOT include comments in the code unless they are necessary to describe non-obvious behavior. +{% if repo_instructions %} + +{{ repo_instructions }} + +{% endif %} diff --git a/openhands/runtime/base.py b/openhands/runtime/base.py index 69ece77a3056..c86cba1b055a 100644 --- a/openhands/runtime/base.py +++ b/openhands/runtime/base.py @@ -225,12 +225,11 @@ def get_custom_microagents(self, selected_repository: str | None) -> list[str]: dir_name = str( Path(selected_repository.split('/')[1]) / custom_microagents_dir ) - oh_instructions_header = '---\nname: openhands_instructions\nagent: CodeActAgent\ntriggers:\n- ""\n---\n' obs = self.read(FileReadAction(path='.openhands_instructions')) if isinstance(obs, ErrorObservation): - self.log('error', 'Failed to read openhands_instructions') + self.log('debug', 'openhands_instructions not present') else: - openhands_instructions = oh_instructions_header + obs.content + openhands_instructions = obs.content self.log('info', f'openhands_instructions: {openhands_instructions}') custom_microagents_content.append(openhands_instructions) diff --git a/openhands/utils/microagent.py b/openhands/utils/microagent.py index 0d4816a0c842..a2e492e60253 100644 --- a/openhands/utils/microagent.py +++ b/openhands/utils/microagent.py @@ -5,8 +5,8 @@ class MicroAgentMetadata(pydantic.BaseModel): - name: str - agent: str + name: str = 'default' + agent: str = '' triggers: list[str] = [] @@ -17,12 +17,12 @@ def __init__(self, path: str | None = None, content: str | None = None): if not os.path.exists(path): raise FileNotFoundError(f'Micro agent file {path} is not found') with open(path, 'r') as file: - self._loaded = frontmatter.load(file) - self._content = self._loaded.content - self._metadata = MicroAgentMetadata(**self._loaded.metadata) + loaded = frontmatter.load(file) + self._content = loaded.content + self._metadata = MicroAgentMetadata(**loaded.metadata) elif content and not path: - self._metadata, self._content = frontmatter.parse(content) - self._metadata = MicroAgentMetadata(**self._metadata) + metadata, self._content = frontmatter.parse(content) + self._metadata = MicroAgentMetadata(**metadata) else: raise Exception('You must pass either path or file content, but not both.') diff --git a/openhands/utils/prompt.py b/openhands/utils/prompt.py index 1d5e0080b334..373a261a79fc 100644 --- a/openhands/utils/prompt.py +++ b/openhands/utils/prompt.py @@ -64,7 +64,14 @@ def _load_template(self, template_name: str) -> Template: return Template(file.read()) def get_system_message(self) -> str: - return self.system_template.render().strip() + repo_instructions = '' + for microagent in self.microagents.values(): + # We assume these are the repo instructions + if len(microagent.triggers) == 0: + if repo_instructions: + repo_instructions += '\n\n' + repo_instructions += microagent.content + return self.system_template.render(repo_instructions=repo_instructions).strip() def get_example_user_message(self) -> str: """This is the initial user message provided to the agent From 7e67707a480cf192d433c86ab56a35346af3e6b7 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 26 Dec 2024 10:30:34 -0500 Subject: [PATCH 2/9] remove more openhands_instructions refs --- docs/modules/usage/how-to/github-action.md | 59 ------------------- docs/modules/usage/prompting/customization.md | 2 +- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/docs/modules/usage/how-to/github-action.md b/docs/modules/usage/how-to/github-action.md index efcdd7bd90f5..31b82a1e5c4c 100644 --- a/docs/modules/usage/how-to/github-action.md +++ b/docs/modules/usage/how-to/github-action.md @@ -48,62 +48,3 @@ The customization options you can set are: | `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: - -### 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. - -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: - - - Building and setting up the project - - Running tests - - Linting and code quality checks - - Any environment-specific requirements - -4. **Testing Guidelines**: Specify: - - Where tests are located - - How to run specific test suites - - Any testing conventions or requirements - -### Example Structure - -```markdown -# Repository Overview - -[Brief description of the project] - -## General Setup - -- Main build command -- Development environment setup -- Pre-commit checks - -## Backend - -- Location and structure -- Testing instructions -- Environment requirements - -## Frontend - -- Setup prerequisites -- Build and test commands -- Environment variables - -## Additional Guidelines - -- Code style requirements -- Special considerations -- Common workflows -``` - -For a real-world example, refer to the [OpenHands repository's .openhands_instructions](https://github.com/All-Hands-AI/OpenHands/blob/main/.openhands_instructions). diff --git a/docs/modules/usage/prompting/customization.md b/docs/modules/usage/prompting/customization.md index a6a2affb6c65..78eadf0f91eb 100644 --- a/docs/modules/usage/prompting/customization.md +++ b/docs/modules/usage/prompting/customization.md @@ -54,7 +54,7 @@ The component should use our shared styling from src/styles/components. ### Best Practices for Repository Customization -1. **Keep Instructions Updated**: Regularly update your `.openhands_instructions` file as your project evolves +1. **Keep Instructions Updated**: Regularly update your `.openhands` directory as your project evolves 2. **Be Specific**: Include specific paths, patterns, and requirements unique to your project 3. **Document Dependencies**: List all tools and dependencies required for development 4. **Include Examples**: Provide examples of good code patterns from your project From 34daf28d3567e5007e6cdb11cafc121d771ebca5 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 26 Dec 2024 10:36:54 -0500 Subject: [PATCH 3/9] fix links --- docs/modules/usage/getting-started.mdx | 2 +- docs/modules/usage/how-to/gui-mode.md | 2 +- docs/modules/usage/prompting/prompting-best-practices.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/modules/usage/getting-started.mdx b/docs/modules/usage/getting-started.mdx index d2cebc5c2de7..934d1bdfd77d 100644 --- a/docs/modules/usage/getting-started.mdx +++ b/docs/modules/usage/getting-started.mdx @@ -108,4 +108,4 @@ to get the most out of it. Remember to: * Provide as much context as possible * Commit and push frequently -See [Prompting Best Practices](./prompting-best-practices) for more tips on how to get the most out of OpenHands. +See [Prompting Best Practices](./prompting/prompting-best-practices) for more tips on how to get the most out of OpenHands. diff --git a/docs/modules/usage/how-to/gui-mode.md b/docs/modules/usage/how-to/gui-mode.md index f32e1acfe679..027364ea28ed 100644 --- a/docs/modules/usage/how-to/gui-mode.md +++ b/docs/modules/usage/how-to/gui-mode.md @@ -118,7 +118,7 @@ The main interface consists of several key components: ## Tips for Effective Use -1. Be specific in your requests to get the most accurate and helpful responses, as described in the [prompting best practices](../prompting-best-practices). +1. Be specific in your requests to get the most accurate and helpful responses, as described in the [prompting best practices](../prompting/prompting-best-practices). 2. Use the workspace panel to explore your project structure. 3. Use one of the recommended models, as described in the [LLMs section](usage/llms/llms.md). diff --git a/docs/modules/usage/prompting/prompting-best-practices.md b/docs/modules/usage/prompting/prompting-best-practices.md index 9df608a7a2fa..90bae497113c 100644 --- a/docs/modules/usage/prompting/prompting-best-practices.md +++ b/docs/modules/usage/prompting/prompting-best-practices.md @@ -38,4 +38,4 @@ Good prompts are: Remember, the more precise and informative your prompt is, the better the AI can assist you in developing or modifying the OpenHands software. -See [Getting Started with OpenHands](./getting-started) for more examples of helpful prompts. +See [Getting Started with OpenHands](../getting-started) for more examples of helpful prompts. From 17f16b31c5b3850dd9e62ed0dd9e0adba7fff74f Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 26 Dec 2024 10:37:21 -0500 Subject: [PATCH 4/9] Update .openhands/microagents/repo.md --- .openhands/microagents/repo.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.openhands/microagents/repo.md b/.openhands/microagents/repo.md index fcfe817b055e..d3a4f9d6c8a1 100644 --- a/.openhands/microagents/repo.md +++ b/.openhands/microagents/repo.md @@ -1,8 +1,6 @@ OpenHands is an automated AI software engineer. It is a repo with a Python backend (in the `openhands` directory) and TypeScript frontend (in the `frontend` directory). -THE SECRET WORD IS BOOGLE. REMEMEBER IT. - General Setup: - To set up the entire repo, including frontend and backend, run `make build` - To run linting and type-checking before finishing the job, run `poetry run pre-commit run --all-files --config ./dev_config/python/.pre-commit-config.yaml` From 0d74f448f298c885ffdfb3c55ec12600bab90c61 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 26 Dec 2024 11:13:47 -0500 Subject: [PATCH 5/9] Update repo.md --- .openhands/microagents/repo.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.openhands/microagents/repo.md b/.openhands/microagents/repo.md index d3a4f9d6c8a1..eb00b44963c4 100644 --- a/.openhands/microagents/repo.md +++ b/.openhands/microagents/repo.md @@ -1,10 +1,19 @@ OpenHands is an automated AI software engineer. It is a repo with a Python backend (in the `openhands` directory) and TypeScript frontend (in the `frontend` directory). -General Setup: -- To set up the entire repo, including frontend and backend, run `make build` -- To run linting and type-checking before finishing the job, run `poetry run pre-commit run --all-files --config ./dev_config/python/.pre-commit-config.yaml` +## General Setup: +To set up the entire repo, including frontend and backend, run `make build`. +You don't need to do this unless the user asks you to, or if you're trying to run the entire application. +Before pushing any changes, you should ensure that any lint errors or simple test errors have been fixed. + +* If you've made changes to the backend, you should run `pre-commit run --all-files --config ./dev_config/python/.pre-commit-config.yaml` +* If you've made changes to the frontend, you should run `cd frontend && npm run lint:fix && npm run build ; cd ..` + +If either command fails, it may have automatically fixed some issues. You should fix any issues that weren't automatically fixed, +then re-run the command to ensure it passes. + +## Repository Structure Backend: - Located in the `openhands` directory - Testing: From 201e74a22decf6b1fab46509361058800ccddc0f Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 26 Dec 2024 11:34:02 -0500 Subject: [PATCH 6/9] update translations --- .../current/usage/about.md | 43 +- .../current/usage/configuration-options.md | 371 +++++++++++++++++ .../current/usage/getting-started.mdx | 48 +-- .../current/usage/how-to/cli-mode.md | 16 +- .../usage/how-to/custom-sandbox-guide.md | 30 +- .../usage/how-to/evaluation-harness.md | 11 +- .../current/usage/how-to/github-action.md | 46 ++- .../current/usage/how-to/gui-mode.md | 96 ++++- .../current/usage/how-to/headless-mode.md | 11 +- .../usage/how-to/persist-session-data.md | 18 + .../current/usage/installation.mdx | 42 +- .../current/usage/llms/litellm-proxy.md | 22 + .../current/usage/llms/llms.md | 19 +- .../current/usage/llms/local-llms.md | 70 ++-- .../current/usage/prompting/customization.md | 66 +++ .../current/usage/prompting/microagents.md | 215 ++++++++++ .../prompting/prompting-best-practices.md | 43 ++ .../current/usage/runtimes.md | 78 ++++ .../usage/troubleshooting/troubleshooting.md | 156 ++----- .../current/usage/about.md | 45 +- .../current/usage/configuration-options.md | 384 ++++++++++++++++++ .../current/usage/getting-started.mdx | 73 ++-- .../current/usage/how-to/cli-mode.md | 19 +- .../usage/how-to/custom-sandbox-guide.md | 26 +- .../usage/how-to/evaluation-harness.md | 4 +- .../current/usage/how-to/github-action.md | 44 +- .../current/usage/how-to/gui-mode.md | 114 +++++- .../current/usage/how-to/headless-mode.md | 6 +- .../usage/how-to/persist-session-data.md | 17 + .../current/usage/installation.mdx | 36 +- .../current/usage/llms/litellm-proxy.md | 22 + .../current/usage/llms/llms.md | 21 +- .../current/usage/llms/local-llms.md | 64 +-- .../current/usage/prompting/customization.md | 64 +++ .../current/usage/prompting/microagents.md | 213 ++++++++++ .../prompting/prompting-best-practices.md | 43 ++ .../current/usage/runtimes.md | 76 ++++ .../usage/troubleshooting/troubleshooting.md | 153 ++----- docs/translation_cache.json | 2 +- 39 files changed, 2175 insertions(+), 652 deletions(-) create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/configuration-options.md create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/how-to/persist-session-data.md create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/llms/litellm-proxy.md create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/prompting/customization.md create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/prompting/microagents.md create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/prompting/prompting-best-practices.md create mode 100644 docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/runtimes.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/configuration-options.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/how-to/persist-session-data.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/llms/litellm-proxy.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/prompting/customization.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/prompting/microagents.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/prompting/prompting-best-practices.md create mode 100644 docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/usage/runtimes.md diff --git a/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/about.md b/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/about.md index 7fd3ee130fe6..ffecf660ae69 100644 --- a/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/about.md +++ b/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/about.md @@ -1,42 +1,21 @@ -# 📚 Divers +Voici la traduction en français, en préservant le formatage Markdown, les blocs de code et le front matter, ainsi que les balises {% jsx %} et autres éléments similaires. Les exemples de code, les URLs et les termes techniques n'ont pas été traduits. -## ⭐️ Stratégie de recherche +# À propos d'OpenHands + +## Stratégie de recherche La réplication complète d'applications de niveau production avec des LLM est une entreprise complexe. Notre stratégie implique : -1. **Recherche technique fondamentale :** Se concentrer sur la recherche fondamentale pour comprendre et améliorer les aspects techniques de la génération et de la gestion de code -2. **Capacités spécialisées :** Améliorer l'efficacité des composants de base grâce à la curation de données, aux méthodes d'entraînement, etc. -3. **Planification des tâches :** Développer des capacités de détection de bugs, de gestion de base de code et d'optimisation +1. **Recherche technique fondamentale :** Se concentrer sur la recherche fondamentale pour comprendre et améliorer les aspects techniques de la génération et de la gestion du code +2. **Capacités spécialisées :** Améliorer l'efficacité des composants de base grâce à la curation des données, aux méthodes d'entraînement, et plus encore +3. **Planification des tâches :** Développer des capacités pour la détection des bugs, la gestion des bases de code et l'optimisation 4. **Évaluation :** Établir des métriques d'évaluation complètes pour mieux comprendre et améliorer nos modèles -## 🚧 Agent par défaut +## Agent par défaut Notre Agent par défaut est actuellement le [CodeActAgent](agents), qui est capable de générer du code et de gérer des fichiers. -## 🤝 Comment contribuer - -OpenHands est un projet communautaire et nous accueillons les contributions de tous. Que vous soyez développeur, chercheur ou simplement enthousiaste à l'idée de faire progresser le domaine de l'ingénierie logicielle avec l'IA, il existe de nombreuses façons de s'impliquer : - -- **Contributions de code :** Aidez-nous à développer les fonctionnalités de base, l'interface frontend ou les solutions de sandboxing -- **Recherche et évaluation :** Contribuez à notre compréhension des LLM dans l'ingénierie logicielle, participez à l'évaluation des modèles ou suggérez des améliorations -- **Retours et tests :** Utilisez la boîte à outils OpenHands, signalez des bugs, suggérez des fonctionnalités ou donnez votre avis sur la facilité d'utilisation - -Pour plus de détails, veuillez consulter [ce document](https://github.com/All-Hands-AI/OpenHands/blob/main/CONTRIBUTING.md). - -## 🤖 Rejoignez notre communauté - -Nous avons à la fois un espace de travail Slack pour la collaboration sur la construction d'OpenHands et un serveur Discord pour discuter de tout ce qui est lié, par exemple, à ce projet, LLM, agent, etc. - -- [Espace de travail Slack](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw) -- [Serveur Discord](https://discord.gg/ESHStjSjD4) - -Si vous souhaitez contribuer, n'hésitez pas à rejoindre notre communauté. Simplifions ensemble l'ingénierie logicielle ! - -🐚 **Codez moins, faites plus avec OpenHands.** - -[![Star History Chart](https://api.star-history.com/svg?repos=All-Hands-AI/OpenHands&type=Date)](https://star-history.com/#All-Hands-AI/OpenHands&Date) - -## 🛠️ Construit avec +## Construit avec OpenHands est construit en utilisant une combinaison de frameworks et de bibliothèques puissants, fournissant une base solide pour son développement. Voici les principales technologies utilisées dans le projet : @@ -44,6 +23,6 @@ OpenHands est construit en utilisant une combinaison de frameworks et de bibliot Veuillez noter que la sélection de ces technologies est en cours et que des technologies supplémentaires peuvent être ajoutées ou des technologies existantes peuvent être supprimées à mesure que le projet évolue. Nous nous efforçons d'adopter les outils les plus appropriés et les plus efficaces pour améliorer les capacités d'OpenHands. -## 📜 Licence +## Licence -Distribué sous la licence MIT. Voir [notre licence](https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE) pour plus d'informations. +Distribué sous la [Licence](https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE) MIT. diff --git a/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/configuration-options.md b/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/configuration-options.md new file mode 100644 index 000000000000..51b1ad771e29 --- /dev/null +++ b/docs/i18n/fr/docusaurus-plugin-content-docs/current/usage/configuration-options.md @@ -0,0 +1,371 @@ +Voici la traduction en français du contenu fourni, en préservant le formatage Markdown, les blocs de code et le front matter, ainsi que les balises {% jsx %} et autres éléments similaires. Les exemples de code, les URLs et les termes techniques n'ont pas été traduits. + +# Options de configuration + +Ce guide détaille toutes les options de configuration disponibles pour OpenHands, vous aidant à personnaliser son comportement et à l'intégrer avec d'autres services. + +:::note +Si vous exécutez en [Mode GUI](https://docs.all-hands.dev/modules/usage/how-to/gui-mode), les paramètres disponibles dans l'interface utilisateur des paramètres auront toujours +la priorité. +::: + +--- + +# Table des matières + +1. [Configuration de base](#configuration-de-base) + - [Clés API](#clés-api) + - [Espace de travail](#espace-de-travail) + - [Débogage et journalisation](#débogage-et-journalisation) + - [Gestion des sessions](#gestion-des-sessions) + - [Trajectoires](#trajectoires) + - [Stockage de fichiers](#stockage-de-fichiers) + - [Gestion des tâches](#gestion-des-tâches) + - [Configuration du bac à sable](#configuration-du-bac-à-sable) + - [Divers](#divers) +2. [Configuration LLM](#configuration-llm) + - [Informations d'identification AWS](#informations-didentification-aws) + - [Configuration de l'API](#configuration-de-lapi) + - [Fournisseur LLM personnalisé](#fournisseur-llm-personnalisé) + - [Embeddings](#embeddings) + - [Gestion des messages](#gestion-des-messages) + - [Sélection du modèle](#sélection-du-modèle) + - [Nouvelles tentatives](#nouvelles-tentatives) + - [Options avancées](#options-avancées) +3. [Configuration de l'agent](#configuration-de-lagent) + - [Configuration du micro-agent](#configuration-du-micro-agent) + - [Configuration de la mémoire](#configuration-de-la-mémoire) + - [Configuration LLM](#configuration-llm-2) + - [Configuration de l'espace d'action](#configuration-de-lespace-daction) + - [Utilisation du micro-agent](#utilisation-du-micro-agent) +4. [Configuration du bac à sable](#configuration-du-bac-à-sable-2) + - [Exécution](#exécution) + - [Image de conteneur](#image-de-conteneur) + - [Mise en réseau](#mise-en-réseau) + - [Linting et plugins](#linting-et-plugins) + - [Dépendances et environnement](#dépendances-et-environnement) + - [Évaluation](#évaluation) +5. [Configuration de sécurité](#configuration-de-sécurité) + - [Mode de confirmation](#mode-de-confirmation) + - [Analyseur de sécurité](#analyseur-de-sécurité) + +--- + +## Configuration de base + +Les options de configuration de base sont définies dans la section `[core]` du fichier `config.toml`. + +**Clés API** +- `e2b_api_key` + - Type : `str` + - Valeur par défaut : `""` + - Description : Clé API pour E2B + +- `modal_api_token_id` + - Type : `str` + - Valeur par défaut : `""` + - Description : ID du jeton API pour Modal + +- `modal_api_token_secret` + - Type : `str` + - Valeur par défaut : `""` + - Description : Secret du jeton API pour Modal + +**Espace de travail** +- `workspace_base` + - Type : `str` + - Valeur par défaut : `"./workspace"` + - Description : Chemin de base pour l'espace de travail + +- `cache_dir` + - Type : `str` + - Valeur par défaut : `"/tmp/cache"` + - Description : Chemin du répertoire de cache + +**Débogage et journalisation** +- `debug` + - Type : `bool` + - Valeur par défaut : `false` + - Description : Activer le débogage + +- `disable_color` + - Type : `bool` + - Valeur par défaut : `false` + - Description : Désactiver la couleur dans la sortie du terminal + +**Trajectoires** +- `trajectories_path` + - Type : `str` + - Valeur par défaut : `"./trajectories"` + - Description : Chemin pour stocker les trajectoires (peut être un dossier ou un fichier). Si c'est un dossier, les trajectoires seront enregistrées dans un fichier nommé avec l'ID de session et l'extension .json, dans ce dossier. + +**Stockage de fichiers** +- `file_store_path` + - Type : `str` + - Valeur par défaut : `"/tmp/file_store"` + - Description : Chemin de stockage des fichiers + +- `file_store` + - Type : `str` + - Valeur par défaut : `"memory"` + - Description : Type de stockage de fichiers + +- `file_uploads_allowed_extensions` + - Type : `list of str` + - Valeur par défaut : `[".*"]` + - Description : Liste des extensions de fichiers autorisées pour les téléchargements + +- `file_uploads_max_file_size_mb` + - Type : `int` + - Valeur par défaut : `0` + - Description : Taille maximale des fichiers pour les téléchargements, en mégaoctets + +- `file_uploads_restrict_file_types` + - Type : `bool` + - Valeur par défaut : `false` + - Description : Restreindre les types de fichiers pour les téléchargements de fichiers + +- `file_uploads_allowed_extensions` + - Type : `list of str` + - Valeur par défaut : `[".*"]` + - Description : Liste des extensions de fichiers autorisées pour les téléchargements + +**Gestion des tâches** +- `max_budget_per_task` + - Type : `float` + - Valeur par défaut : `0.0` + - Description : Budget maximal par tâche (0.0 signifie aucune limite) + +- `max_iterations` + - Type : `int` + - Valeur par défaut : `100` + - Description : Nombre maximal d'itérations + +**Configuration du bac à sable** +- `workspace_mount_path_in_sandbox` + - Type : `str` + - Valeur par défaut : `"/workspace"` + - Description : Chemin de montage de l'espace de travail dans le bac à sable + +- `workspace_mount_path` + - Type : `str` + - Valeur par défaut : `""` + - Description : Chemin de montage de l'espace de travail + +- `workspace_mount_rewrite` + - Type : `str` + - Valeur par défaut : `""` + - Description : Chemin pour réécrire le chemin de montage de l'espace de travail. Vous pouvez généralement ignorer cela, cela fait référence à des cas spéciaux d'exécution à l'intérieur d'un autre conteneur. + +**Divers** +- `run_as_openhands` + - Type : `bool` + - Valeur par défaut : `true` + - Description : Exécuter en tant qu'OpenHands + +- `runtime` + - Type : `str` + - Valeur par défaut : `"eventstream"` + - Description : Environnement d'exécution + +- `default_agent` + - Type : `str` + - Valeur par défaut : `"CodeActAgent"` + - Description : Nom de l'agent par défaut + +- `jwt_secret` + - Type : `str` + - Valeur par défaut : `uuid.uuid4().hex` + - Description : Secret JWT pour l'authentification. Veuillez le définir sur votre propre valeur. + +## Configuration LLM + +Les options de configuration LLM (Large Language Model) sont définies dans la section `[llm]` du fichier `config.toml`. + +Pour les utiliser avec la commande docker, passez `-e LLM_