mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
### What problem does this PR solve? Fix: Pass kwargs in python api #10699 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -40,7 +40,7 @@ class Session(Base):
|
|||||||
If stream=False, returns a single Message object for the final answer.
|
If stream=False, returns a single Message object for the final answer.
|
||||||
"""
|
"""
|
||||||
if self.__session_type == "agent":
|
if self.__session_type == "agent":
|
||||||
res = self._ask_agent(question, stream)
|
res = self._ask_agent(question, stream, **kwargs)
|
||||||
elif self.__session_type == "chat":
|
elif self.__session_type == "chat":
|
||||||
res = self._ask_chat(question, stream, **kwargs)
|
res = self._ask_chat(question, stream, **kwargs)
|
||||||
else:
|
else:
|
||||||
@ -97,9 +97,11 @@ class Session(Base):
|
|||||||
json_data, stream=stream)
|
json_data, stream=stream)
|
||||||
return res
|
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",
|
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
|
return res
|
||||||
|
|
||||||
def update(self, update_message):
|
def update(self, update_message):
|
||||||
|
|||||||
Reference in New Issue
Block a user