File size: 523 Bytes
30de231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from minichain import prompt, Mock, show
import minichain

@prompt(Mock(["hello"]))
def prompt_function1(model, x):
    return model(x)

@prompt(Mock(["b"]), template_file="test.pmpt.tpl")
def prompt_function2(model, x):
    return model(dict(x=x))
    
def run(query):
    x = prompt_function1(query)
    return prompt_function2(prompt_function2(x))


demo = show(run,
            examples=["a"],
            subprompts=[prompt_function1, prompt_function2, prompt_function2])

if __name__ == "__main__":
    demo.launch()