Skip to content

Commit

Permalink
update samples to use new prompt separator
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuhang Liu committed Oct 19, 2023
1 parent 2ef0182 commit 7ce0580
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 34 deletions.
8 changes: 4 additions & 4 deletions examples/flows/chat/basic-chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ In this flow, you will learn
- prompt template format of LLM tool chat api. Message delimiter is a separate line containing role name and colon: "system:", "user:", "assistant:".
See <a href="https://platform.openai.com/docs/api-reference/chat/create#chat/create-role" target="_blank">OpenAI Chat</a> for more about message role.
```jinja
system:
# system:
You are a chatbot having a conversation with a human.

user:
# user:
{{question}}
```
- how to consume chat history in prompt.
```jinja
{% for item in chat_history %}
user:
# user:
{{item.inputs.question}}
assistant:
# assistant:
{{item.outputs.answer}}
{% endfor %}
```
Expand Down
8 changes: 4 additions & 4 deletions examples/flows/chat/basic-chat/chat.jinja2
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
system:
# system:
You are a helpful assistant.

{% for item in chat_history %}
user:
# user:
{{item.inputs.question}}
assistant:
# assistant:
{{item.outputs.answer}}
{% endfor %}

user:
# user:
{{question}}
8 changes: 4 additions & 4 deletions examples/flows/chat/chat-with-wikipedia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ In this flow, you will learn
- prompt template format of LLM tool chat api. Message delimiter is a separate line containing role name and colon: "system:", "user:", "assistant:".
See <a href="https://platform.openai.com/docs/api-reference/chat/create#chat/create-role" target="_blank">OpenAI Chat</a> for more about message role.
```jinja
system:
# system:
You are a chatbot having a conversation with a human.

user:
# user:
{{question}}
```
- how to consume chat history in prompt.
```jinja
{% for item in chat_history %}
user:
# user:
{{item.inputs.question}}
assistant:
# assistant:
{{item.outputs.answer}}
{% endfor %}
```
Expand Down
8 changes: 4 additions & 4 deletions examples/flows/chat/chat-with-wikipedia/augmented_chat.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
system:
# system:
You are a chatbot having a conversation with a human.
Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES").
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
Expand All @@ -7,11 +7,11 @@ ALWAYS return a "SOURCES" part in your answer.
{{contexts}}

{% for item in chat_history %}
user:
# user:
{{item.inputs.question}}
assistant:
# assistant:
{{item.outputs.answer}}
{% endfor %}

user:
# user:
{{question}}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
system:
# system:
You are an AI assistant reading the transcript of a conversation between an AI and a human. Given an input question and conversation history, infer user real intent.

The conversation history is provided just in case of a context (e.g. "What is this?" where "this" is defined in previous conversation).

Return the output as query used for next round user message.

user:
# user:
EXAMPLE
Conversation history:
Human: I want to find the best restaurants nearby, could you recommend some?
Expand Down
4 changes: 2 additions & 2 deletions examples/flows/standard/basic-with-builtin-llm/hello.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
system:
# system:
You are a assistant which can write code. Response should only contain code.

user:
# user:
Write a simple {{text}} program that displays the greeting message when executed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
system:
# system:
There is a search bar in the mall APP and users can enter any query in the search bar.

The user may want to search for orders, view product information, or seek recommended products.
Expand All @@ -7,5 +7,5 @@ Therefore, please classify user intentions into the following three types accord

Please note that only the above three situations can be returned, and try not to include other return values.

user:
# user:
The user's query is {{query}}
4 changes: 2 additions & 2 deletions examples/flows/standard/maths-to-code/ask_llm.jinja2
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
system:
# system:
I want you to act as a Math expert specializing in Algebra, Geometry, and Calculus. Given the question, develop python code to model the user's question.
The python code will print the result at the end.
Please generate executable python code, your reply will be in JSON format, something like:
{
"code": "print(1+1)"
}

user:
# user:
This a set of examples including question and the final answer:
{% for ex in examples %}
QUESTION: {{ ex.question }}
Expand Down
4 changes: 2 additions & 2 deletions examples/flows/standard/maths-to-code/prompt_gen.jinja2
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
system:
# system:
I want you to act as a Math expert specializing in Algebra, Geometry, and Calculus. Given the question, develop python code to model the user's question.
The python code will print the result at the end.
Please generate executable python code, your reply will be in JSON format, something like:
{
"code": "print(1+1)"
}

user:
# user:
This a set of examples including question and the final answer:
{% for ex in examples %}
QUESTION: {{ ex.question }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
system:
# system:
Your task is to find entities of certain type from the given text content.
If there're multiple entities, please return them all with comma separated, e.g. "entity1, entity2, entity3".
You should only return the entity list, nothing else.
If there's no such entity, please return "None".

user:
# user:
Entity type: {{entity_type}}
Text content: {{text}}
Entities:
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
system:
# system:
Your task is to classify a given url into one of the following categories:
Movie, App, Academic, Channel, Profile, PDF or None based on the text content information.
The classification will be based on the url, the webpage text content summary, or both.

user:
# user:
The selection range of the value of "category" must be within "Movie", "App", "Academic", "Channel", "Profile", "PDF" and "None".
The selection range of the value of "evidence" must be within "Url", "Text content", and "Both".
Here are a few examples:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
system:
# system:
Please summarize the following text in one paragraph. 100 words.
Do not add any information that is not in the text.

user:
# user:
Text: {{text}}
Summary:
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
system:
# system:
Please summarize some keywords of this paragraph and have some details of each keywords.
Do not add any information that is not in the text.

user:
# user:
Text: {{text}}
Summary:

0 comments on commit 7ce0580

Please sign in to comment.