Skip to content

Commit

Permalink
Update prompts for claude2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii-Klimov committed Nov 28, 2023
1 parent faea324 commit ff4e70d
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions aidial_assistant/application/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,81 +29,85 @@ def build(self, **kwargs) -> Template:


_REQUEST_EXAMPLE_TEXT = """
ALWAYS reply with a JSON containing an array of available commands. You must not use natural language:
You should ALWAYS reply with a JSON containing an array of commands:
{
"commands": [
{
"command": "<command name>",
"args": [
<array of arguments>
// <array of arguments>
]
}
]
}
Example:
{"commands": [{"command": "reply", "args": ["Hello, world!"]}]}
The commands are invoked by system on user's behalf.
""".strip()

_SYSTEM_TEXT = """
Today's date is {{today_date}}.
This message defines the following communication protocol.
{%- if system_prefix %}
{{system_prefix}}
{%- endif %}
Protocol
The following commands are available to reply to user or find out the answer to the user's question:
# Protocol
{{request_response}}
## Commands
{%- if tools %}
> run-plugin
The command runs a specified plugin to solve a one-shot task written in natural language.
Plugins do not see current conversation and require all details to be provided in the query to solve the task.
The command returns the result of the plugin call.
Arguments:
- NAME is one of the following plugins:
{%- for name, description in tools.items() %}
* {{name}} - {{description | decap}}
{%- endfor %}
- QUERY is a string formulating the query to the plugin.
- QUERY is the query string.
{%- endif %}
> reply
The command delivers ultimate result to the user.
Arguments:
- MESSAGE is a string containing response for user.
- MESSAGE is a string containing the final and complete result for the user.
{{request_response}}
## Example
{"commands": [{"command": "reply", "args": ["Hello, world!"]}]}
""".strip()

_PLUGIN_SYSTEM_TEXT = """
Today's date is {{today_date}}.
This message defines the following communication protocol.
Service
# Service
API_DESCRIPTION:
{{api_description}}
API_SCHEMA:
# API Schema
```typescript
{{api_schema}}}
```
Protocol
The following commands are available to reply to user or find out the answer to the user's question:
# Protocol
{{request_response}}
## Commands
{%- for command_name in command_names %}
> {{command_name}}
Arguments:
- <JSON dict according to the API_SCHEMA>
- <JSON dict according to the API Schema>
{%- endfor %}
> reply
The command delivers ultimate result to the user
Arguments:
- MESSAGE is a string containing response for user.
- MESSAGE is a string containing the final and complete result for the user.
{{request_response}}
## Example
{"commands": [{"command": "reply", "args": ["Hello, world!"]}]}
""".strip()

_ENFORCE_JSON_FORMAT_TEXT = """
{{response}}
**Remember to reply with a JSON with commands**
""".strip()

_MAIN_BEST_EFFORT_TEXT = (
Expand Down

0 comments on commit ff4e70d

Please sign in to comment.