You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I load the json file
import json
from langflow.graph.graph.base import Graph
from langflow.processing.process import run_graph
import uuid
Generate a valid UUID
valid_uuid = str(uuid.uuid4()) # This will generate a valid UUID string
Load your flow JSON
with open("Basic Prompting.json", "r") as f:
flow_json = json.load(f)
user_id = flow_json.get("user_id") # Extract user_id from root
graph_data = flow_json["data"]
Build the Graph with user_id
graph = Graph.from_payload(graph_data, user_id=user_id,flow_id=valid_uuid)
Run the graph (async)
import asyncio
async def main():
results = await run_graph(
graph=graph,
input_value="Hello, World!",
input_type="chat",
output_type="chat",
session_id="my_session_123"
)
print(results)
asyncio.run(main())
By using this ,I can get an invoke response.I want to get a stream response,how to do it? Please show me the codes.
Beta Was this translation helpful? Give feedback.
All reactions