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

Are there any way to provide Few-shot prompt in Prompty? #140

Open
07JP27 opened this issue Dec 4, 2024 · 3 comments
Open

Are there any way to provide Few-shot prompt in Prompty? #140

07JP27 opened this issue Dec 4, 2024 · 3 comments

Comments

@07JP27
Copy link

07JP27 commented Dec 4, 2024

I want to express Few-shot prompting in prompty file.
I think it can be achieved if I could write like the following Prompty format, but it seems that the 'assistant' role is not supported in Prompty.
Are there any way to provide few-shot in Prompty file or any schedule that implement assistant role in Prompty?

---
metadata omitted
sample:
  question: What is Prompty?
---
system:
You are an AI assistant.

user:
[Few-shot user question]

assistant:
[Few-shot AI answer]

user:
{{question}}
@injeniero
Copy link
Contributor

I see this working properly on the VS extension, and inspecting the python code, it seems it should work as well.

What is not working is the "highlight" in the VS extension for the role assistant, but it still works.

@07JP27
Copy link
Author

07JP27 commented Dec 5, 2024

@injeniero
Thank you for your great information.
As you said, I assumed it was not supported because the assistant role was not highlighted in VS Code.
But it was indeed accomplished.
I hope this fact reflect to VS code extension (Highlight feature) and sample code in document of Prompty :)

system:
You are an AI assistant supporting a user named "{{userName}}". 

user:
Hello

assistant:
Hi

user:
{{question}}
prompt = prompty.load("./basic.prompty")
print(prompty.prepare(prompt, {"userName": "John", "question":"What's up?"}))
[
  {'role': 'system', 'content': 'You are an AI assistant supporting a user named "John".'},
  {'role': 'user', 'content': 'Hello'}, 
  {'role': 'assistant', 'content': 'Hi'},
  {'role': 'user', 'content': "What's up?"}
]

VS code view (only assistant role has not highlighted)
Image

@sethjuarez
Copy link
Member

Looks like an extension issue. Will tag this as an extension bug.

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

3 participants