Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Pass kwargs in python api #10699 (#10808)

Billy Bao16ec6ad34616
diff --git a/sdk/python/ragflow_sdk/modules/session.py b/sdk/python/ragflow_sdk/modules/session.py
index 899a48fa99..30d7aeea33 100644
--- a/sdk/python/ragflow_sdk/modules/session.py
+++ b/sdk/python/ragflow_sdk/modules/session.py
@@ -40,7 +40,7 @@ class Session(Base):
If stream=False, returns a single Message object for the final answer.
"""
if self.__session_type == "agent":
- res = self._ask_agent(question, stream)
+ res = self._ask_agent(question, stream, **kwargs)
elif self.__session_type == "chat":
res = self._ask_chat(question, stream, **kwargs)
else:
@@ -97,9 +97,11 @@ class Session(Base):
json_data, stream=stream)
return res
- def _ask_agent(self, question: str, stream: bool):
+ def _ask_agent(self, question: str, stream: bool, **kwargs):
+ json_data = {"question": question, "stream": stream, "session_id": self.id}
+ json_data.update(kwargs)
res = self.post(f"/agents/{self.agent_id}/completions",
- {"question": question, "stream": stream, "session_id": self.id}, stream=stream)
+ json_data, stream=stream)
return res
def update(self, update_message):