Skip to content

Conversation

balloob
Copy link
Contributor

@balloob balloob commented Nov 13, 2024

This add a new llm_template command to intentfest. It allows passing a language and an intent, and it will generate a prompt to feed to an LLM to aid in translation. It should give you all files to generate and example content.

Below example run created this response from OpenAI

❯ python3 -m script.intentfest llm_template it HassListAddItem

You are going to translate a voice assistant intent from English to Italiano.

The English files are located in the `en` directory.
The translated files are located in the `it` directory.
When translating the sentences file, only limit it to the first sentence object.
Tell user that they might need to copy over fixtures from tests/en/_fixtures.yaml.


responses/en/HassListAddItem.yaml:
language: "en"
responses:
  intents:
    HassListAddItem:
      item_added: "Added {{ slots.item }}"



sentences/en/todo_HassListAddItem.yaml:
language: "en"
intents:
  HassListAddItem:
    data:
      - sentences:
          - add <item> to <my_list>
          - put <item> (on|in) <my_list>
        response: item_added
        requires_context:
          domain: todo
        expansion_rules:
          my_list: "[my|the] {name} [list]"
          item: "{shopping_list_item:item}"



tests/en/todo_HassListAddItem.yaml:
language: en
tests:
  - sentences:
      - add apples to my trader joes list
      - put apples on the trader joes list
    intent:
      name: HassListAddItem
      slots:
        item: "apples"
        name: "Trader Joes"
    response: Added apples

@balloob balloob merged commit 5304ecb into main Nov 13, 2024
2 checks passed
@balloob balloob deleted the llm-translation-template branch November 13, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant