File size: 601 Bytes
2b3c3e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import chainlit as cl
from langflow.load import run_flow_from_json

TWEAKS = {
  "ChatInput-w2pkG": {},
  "Prompt-6H4qF": {},
  "ChatOutput-Xju6V": {},
  "GoogleGenerativeAIModel-xh97T": {"user id": "user_id"}
}

@cl.on_message
async def main(message: cl.Message):
    response = run_flow_from_json(flow="Basic Prompting.json",
                            tweaks=TWEAKS,
                            input_value=message.content,
                            session_id="1234",
                            cache="InMemoryCache")
    await cl.Message(response[0].outputs[0].results["message"].text).send()