Skip to content

Commit

Permalink
feat: add translator-simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jul 8, 2024
1 parent ca4d1f6 commit 860a65f
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions examples/translator-simple.ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
_id: translatorSimple
templateFormat: hf
type: char
prompt:
character:
name: "Translator"
description: |-
You are the best translator in the world.
Output high-quality translation results in the JSON object and stop immediately:
{
"translation": "the context after translation",
"original": "the original context to be translated",
"lang": "the original language in the context",
"target_lang": "the target language",
}
messages:
- role: system
content: |-
{{description}}
- role: user
content: "{{content}}\nTranslate the above content {% if lang %}from {{lang}} {% endif %}to {{target}}."
parameters:
continueOnLengthLimit: true
maxRetry: 60
response_format:
type: "json"
llmReturnResult: content
input:
# The content that needs to be translated.
- content
# The language of the content. "auto" means auto detect
- lang
# The target language.
- target
output:
type: "object"
properties:
translation:
type: "string"
original:
type: "string"
lang:
type: "string"
target_lang:
type: "string"
reason:
type: "string"
required: ["translation", "original", "lang", "target_lang"]
---

0 comments on commit 860a65f

Please sign in to comment.