Open agilebean opened 1 month ago
Thanks! Try this branch and set your configurables like this
config = {"user_id": "123", "conversation_id": "1"}
lc.set_configurable(config)
session_id
is an configurable on its own and should not be hard-coded anyway.
@TomTom101 I tried this but didn't work. Doesn't the invoke method need to access it like this?
async def _ainvoke(self, text: dict):
...
if hasattr(self, '_configurable'):
configurable = self._configurable
else:
configurable = {"configurable": {"session_id": self._participant_id}}
This is a strategically important issue for me to use pipecat for good.
pipecat:LangchainProcessor
wrapslangchain:RunnableWithHistory
. I need to replacesession_id
with two fieldsuser_id
andconversation_id
as shown in the Langchain documentation.My code
Error
The above code throws
Tried changing the pipecat code to replace session_id in
langchain.py
as:but this throws
I could extend that to accept the custom parameters but i was looking for a more general solution which established pipecat contributors like @TomTom101 could think of.
Langchain code
As I understand the langchain code, this is how the custom config can be passed:
langchain_core/runnables/base.py
, line 5242, in astream():which calls
langchain_core/runnables/history.py
, lines 533ff:Pipecat code
So in
pipecat/processors/frame_processor.py
, the_ainvoke
method uses only thesession_id
Suggested Solution
So
_ainvoke
could be extended to pass the the keys from langchain'sself.history_factory_config
? Maybe something along this snippet:OR is there another way to pass the
config
dict for the new parameters to LangchainProcessor?