Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/docs/usage-guide/additional_configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ All Qodo Merge tools have a parameter called `extra_instructions`, that enables
/update_changelog --pr_update_changelog.extra_instructions="Make sure to update also the version ..."
```

## Localization

The default response language for Qodo Merge is **U.S. English**. However, some development teams may prefer to display information in a different language. For example, your team's workflow might improve if PR descriptions and code suggestions are set to your country's native language.

To configure this, set the `response_language` parameter in the configuration file. This will prompt the model to respond in the specified language. Use a **standard locale code** based on [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166) (country codes) and [ISO 639](https://en.wikipedia.org/wiki/ISO_639) (language codes) to define a language-country pair. See this [comprehensive list of locale codes](https://simplelocalize.io/data/locales/).

### Example:

```yaml
response_language: "he-IL"
```

This will set the response language globally for [describe](../tools/describe.md), [improve](../tools/improve.md), [add_docs](../tools/documentation.md), [update_changelog](../tools/update_changelog.md), [test](../tools/test.md) commands to Hebrew

> **Important:** Note that only dynamic text generated by the AI model is translated to the configured language. Static text such as labels and table headers that are not part of the AI modeles response will remain in US English.

## Working with large PRs

The default mode of CodiumAI is to have a single call per tool, using GPT-4, which has a token limit of 8000 tokens.
Expand Down
11 changes: 11 additions & 0 deletions pr_agent/agent/pr_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
commands = list(command2class.keys())



class PRAgent:
def __init__(self, ai_handler: partial[BaseAiHandler,] = LiteLLMAIHandler):
self.ai_handler = ai_handler # will be initialized in run_action
Expand Down Expand Up @@ -72,6 +73,16 @@ async def handle_request(self, pr_url, request, notify=None) -> bool:
# Update settings from args
args = update_settings_from_args(args)

# Append the response language in the extra instructions
response_language = get_settings().config.response_language
if response_language != 'en-us':
for key in get_settings():
setting = get_settings().get(key)
if str(type(setting)) == "<class 'dynaconf.utils.boxing.DynaBox'>":
if hasattr(setting, 'extra_instructions'):
extra_instructions = get_settings()[key.lower()].extra_instructions
get_settings()[key.lower()].extra_instructions = f"{extra_instructions} \n======\n\nLanguage preference from the user\n======\n In your reply only use the lanaguage with locale code: {response_language}"

action = action.lstrip("/").lower()
if action not in command2class:
get_logger().error(f"Unknown command: {action}")
Expand Down
1 change: 1 addition & 0 deletions pr_agent/settings/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
model="gpt-4o-2024-11-20"
fallback_models=["gpt-4o-2024-08-06"]
#model_weak="gpt-4o-mini-2024-07-18" # optional, a weaker model to use for some easier tasks
response_language="en-US" # Language locales code for PR responses in ISO 3166 and ISO 639 format (e.g., "en-US", "es-ES", "he-IL", "ar-IL", "zh-CN")
# CLI
git_provider="github"
publish_output=true
Expand Down