prompty icon indicating copy to clipboard operation
prompty copied to clipboard

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

Open 07JP27 opened this issue 1 year ago • 3 comments

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}}

07JP27 avatar Dec 04 '24 01:12 07JP27

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.

injeniero avatar Dec 04 '24 16:12 injeniero

@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

07JP27 avatar Dec 05 '24 03:12 07JP27

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

sethjuarez avatar Dec 13 '24 21:12 sethjuarez