Comments (10)
![image](https://private-user-images.githubusercontent.com/129599379/268325924-39b8577f-2d1a-41ec-89a8-68225b62a396.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4MDkyOTUsIm5iZiI6MTcxOTgwODk5NSwicGF0aCI6Ii8xMjk1OTkzNzkvMjY4MzI1OTI0LTM5Yjg1NzdmLTJkMWEtNDFlYy04OWE4LTY4MjI1YjYyYTM5Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzAxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwMVQwNDQzMTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYTZjMjFmNzlkMmNmYmIxYTAxMmYwYjkzZTc0YWI3ZTQ4YTUwNTQ0MTRmNGFmNGI4ODA0MWUwMjk2ODE1YzkzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.jCEkjXi5qbGVKmQvfgE5HasO69_mQE7mt-oiLBa7FOk)
that indeed did the job. now looks like this
from docs.
Nice catch, what version of langflow are you using? Can you try upgrading it? Or maybe they released a breaking change.
from docs.
Langflow v0.2.7
from docs.
This seems pretty outdated, can you run pip -U langflow
and try again?
from docs.
yeah updated it to 0.4.16 and similar error:
TypeError: load_flow_from_json() got an unexpected keyword argument 'flow'
2023-09-13 16:32:38 - 'NoneType' object has no attribute 'agent'
Traceback (most recent call last):
File "/Users/simonau/Documents/Lending/env/lib/python3.11/site-packages/chainlit/utils.py", line 40, in wrapper
return await user_function(**params_values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/simonau/Documents/Lending/main_tool_langflow.py", line 29, in main
flow.agent.llm_chain.llm.streaming = True
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'agent'
from docs.
So this error is a bit different, the flow was successfully loaded but it no longer have an agent
attribute. But at least this is reaching the code of your app file.
from docs.
import json
from langchain.agents import AgentExecutor
from langflow import load_flow_from_json
from chainlit.langflow import load_flow
import chainlit as cl
#import os
#os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
#os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
with open("./schema.json", "r") as f:
schema = json.load(f)
@cl.on_chat_start
async def start():
flow = await load_flow(schema=schema)
cl.user_session.set("flow", flow)
@cl.on_message
async def main(message):
# Load the flow from the user session
flow = cl.user_session.get("flow") # type: AgentExecutor
# Enable streaming
flow.agent.llm_chain.llm.streaming = True
# Run the flow
res = await cl.make_async(flow.run)(
message, callbacks=[cl.LangchainCallbackHandler()]
)
# Send the response
await cl.Message(content=res).send()
This is the exact code.
from docs.
maybe update the main function like so:
@cl.on_message
async def main(message):
# Load the flow from the user session
flow = cl.user_session.get("flow") # type: AgentExecutor
# Run the flow
res = await cl.make_async(flow)(
message, callbacks=[cl.LangchainCallbackHandler()]
)
# Send the response
await cl.Message(content=res).send()
from docs.
Any idea how i can get it parse it correctly?
from docs.
What do you mean by "parsing"?
from docs.
Related Issues (20)
- Issue on integrating chat resume. HOT 13
- Issue on Callback Handler: LangChainDeprecationWarning HOT 1
- Issue on docs
- Copilot instructions don't match cookbook
- Issue on docs: Human Feedback not working
- how to display markdown math equation?
- Need voice input code for chainlit
- Question
- Missing dependencies in docs
- Dangling section in docs
- Testing & Debugging page ambiguous about usage
- Issue on docs
- Issue on docs: how to use the Environment Variables for Public Apps HOT 1
- Using copilot on Brave Browser : does not seem to be working
- Issue on docs
- CrewAI agent integrations HOT 3
- Explain how authentication would work when mounting Chainlit as a FastAPI sub-app
- Issue on docs: Authentication via headers docs incomplete HOT 1
- Issue on docs: @cl.set_starters is not working
- Issue on docs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.