First, It would die in the node research_plan_node
, particular in this:
content = state['content'] or []
2 queries = model.with_structured_output(Queries).invoke([
3 SystemMessage(content=RESEARCH_PLAN_PROMPT),
4 HumanMessage(content=state['task'])
5 ])
6 print(state)
----> 7 content = content = state['content'] or []
8 for q in queries.queries:
9 response = tavily.search(query=q, max_results=2)
KeyError: 'content'
so I changed to content = state['content'] if 'content' in state else []
(also in the function research_critique_node)
That fixed the issue. However, I got another error:
ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 8572948288 and this is thread id 6215086080.
Instead of using memory = SqliteSaver.from_conn_string(":memory:")
because it was failing, I used sqlite3.connect
as:
import sqlite3
conn = sqlite3.connect('checkpointer.db')
memory = SqliteSaver(conn)
graph = builder.compile(checkpointer=memory)
.... <loop code here>
conn.close()
Later, I changed to use a block, as a content manager:
graph = builder.compile(checkpointer=checkpointer)
thread = {"configurable": {"thread_id": "1"}}
for s in graph.stream({
'task': "what is the difference between langchain and langsmith",
"max_revisions": 2,
"revision_number": 1,
}, thread):
print(s)
and that was fine. However, I cannot get the Essay Writer Interface to work.
Where can I find the helper
library. Which one it’s using?
Thanks in advance!