You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			Readme
Files and versions
Updated 2 years ago
prompt
question-answer
Desription
Prompt Template.
Code Example
Example
from towhee import ops, pipe
import requests
towhee_docs = requests.get('https://raw.githubusercontent.com/towhee-io/towhee/main/README.md').content
temp = """{question}
input:
{context}
"""
p = (
    pipe.input('question', 'doc', 'history')
    .map(('question', 'doc', 'history'), 'prompt', ops.prompt.template(temp))
    .map('prompt', 'answer', ops.LLM.OpenAI())
    .output('answer')
)
an1 = p('Tell me something about Towhee', towhee_docs, []).get()[0]
an2 = p('Give an example', towhee_docs, [('Tell me something about Towhee', an1)]).get()[0]
Factory Constructor
Create the operator via the following factory method:
ops.prompt.template(temp)
Returns: List[Dict]
|  | 4 Commits | ||
|---|---|---|---|
|  | 
												1.1 KiB
											 | 2 years ago | |
|  | 
												824 B
											 | 2 years ago | |
|  | 
												102 B
											 | 2 years ago | |
|  | 
												804 B
											 | 2 years ago | |
