Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

args in roles.yaml #84

Closed
luckman212 opened this issue Mar 20, 2023 · 7 comments
Closed

args in roles.yaml #84

luckman212 opened this issue Mar 20, 2023 · 7 comments

Comments

@luckman212
Copy link

✨amazing project btw!✨

I was trying to use the translator: role example, but I'm not quite understanding the ARGn substitutions and how they relate to the role name definition in roles.yaml.

Example roles.yaml:

- name: translator:french
  prompt: >
    You will act as a translator between English and __ARG1__.
    Whenever you receive a prompt in either language, you will translate the text into the opposite language and provide the translated output as your response.
    Please ensure that your response contains only the translated text.
    No additional descriptions or explanations, No tags or comments to indicate language direction.

Must I define the name as translator:french or can I make it generic and use translator:lang? Or does it not matter? Is french just a placeholder? Or is it a default? If it's a default, I would expect to be able to write:

aichat -r translator Good afternoon

...without specifying a language parameter. But that doesn't work. You must type the full role spec. Am I using this incorrectly?

@sigoden
Copy link
Owner

sigoden commented Mar 20, 2023

@luckman212
Copy link
Author

@sigoden Thanks, yes I did see that, still not understanding what significance the named params in the roles.yaml have. To be more specific, what is the difference (if any?) between the following 2 role definitions:

- name: convert:json:yaml
  prompt: convert __ARG1__ below to __ARG2__

- name: convert2:sdfgksjdfghksdfjghsdf:c434rhirfhs
  prompt: convert __ARG1__ below to __ARG2__

It appears to me that both of these could be used as

aichat -r convert:yaml:json
aichat -r convert2:yaml:json

?

@sigoden
Copy link
Owner

sigoden commented Mar 20, 2023

The :french suffix is a reminder that you must pass language as role arg, it can be :frech or :chinese.

The :json:yaml suffix is a reminer that you must pass two format as role args. it can be :toml:yaml or :json:ini.

:sdfgksjdfghksdfjghsdf:c434rhirfhs desn't make sense, you won't know how to pass the role arg until you check roles.yaml.

@sigoden
Copy link
Owner

sigoden commented Mar 20, 2023

Give role arg a meaningful name for convenience.

@luckman212
Copy link
Author

Right, so that confirms what I was thinking—the names given in roles.yaml are, in a sense, both args as well as placeholders.

Would it make sense then to allow aichat -r translate without specifying :french and have it use the arg given in the YAML as a default?

@sigoden
Copy link
Owner

sigoden commented Mar 20, 2023

Without role arg, if you want to do following things:

  • convert english to french
  • convert english to chinese
  • convert english to japenese

You need to create three roles seperately

- name: translator-french
  prompt: >
    You will act as a translator between English and french.
- name: translator-chinese
  prompt: >
    You will act as a translator between English and chinese.
- name: translator-japenese
  prompt: >
    You will act as a translator between English and japenese.
aichat -r translator-french hello world
aichat -r translator-chinese hello world
aichat -r translator-japenese hello world

But with role arg, you only need to create one role:

- name: translator:french
  prompt: >
    You will act as a translator between English and __ARG1__.
aichat -r translator:french hello world
aichat -r translator:chinese hello world
aichat -r translator:japenese hello world

It is a generic role now.

@sigoden
Copy link
Owner

sigoden commented Mar 20, 2023

If you want to use aichat -r translate without specifying :french. just add following role to roles.yaml

- name: translate
  prompt: >
    You will act as a translator between English and French.

@sigoden sigoden closed this as completed Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants