mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-04 17:45:07 +08:00
feat: Add a custom header to the SDK for chatting with the agent. (#12430)
### What problem does this PR solve? As title. ### Type of change - [x] New Feature (non-breaking change which adds functionality) Co-authored-by: Liu An <asiro@qq.com>
This commit is contained in:
@ -76,6 +76,8 @@ class AgentParam(LLMParam, ToolParamBase):
|
||||
self.mcp = []
|
||||
self.max_rounds = 5
|
||||
self.description = ""
|
||||
self.custom_header = {}
|
||||
|
||||
|
||||
|
||||
class Agent(LLM, ToolBase):
|
||||
@ -105,7 +107,8 @@ class Agent(LLM, ToolBase):
|
||||
|
||||
for mcp in self._param.mcp:
|
||||
_, mcp_server = MCPServerService.get_by_id(mcp["mcp_id"])
|
||||
tool_call_session = MCPToolCallSession(mcp_server, mcp_server.variables)
|
||||
custom_header = self._param.custom_header
|
||||
tool_call_session = MCPToolCallSession(mcp_server, mcp_server.variables, custom_header)
|
||||
for tnm, meta in mcp["tools"].items():
|
||||
self.tool_meta.append(mcp_tool_metadata_to_openai_tool(meta))
|
||||
self.tools[tnm] = tool_call_session
|
||||
|
||||
Reference in New Issue
Block a user