mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-27 09:13:25 +08:00
* 修复Azure 不设置Max token的bug * 重写agent 1. 修改Agent实现方式,支持多参数,仅剩 ChatGLM3-6b和 OpenAI GPT4 支持,剩余模型将在暂时缺席Agent功能 2. 删除agent_chat 集成到llm_chat中 3. 重写大部分工具,适应新Agent * 更新架构 * 删除web_chat,自动融合 * 移除所有聊天,都变成Agent控制 * 更新配置文件 * 更新配置模板和提示词 * 更改参数选择bug
24 lines
692 B
Python
24 lines
692 B
Python
from pydantic import BaseModel, Field
|
|
|
|
def calculate(a: float, b: float, operator: str) -> float:
|
|
if operator == "+":
|
|
return a + b
|
|
elif operator == "-":
|
|
return a - b
|
|
elif operator == "*":
|
|
return a * b
|
|
elif operator == "/":
|
|
if b != 0:
|
|
return a / b
|
|
else:
|
|
return float('inf') # 防止除以零
|
|
elif operator == "^":
|
|
return a ** b
|
|
else:
|
|
raise ValueError("Unsupported operator")
|
|
|
|
class CalculatorInput(BaseModel):
|
|
a: float = Field(description="first number")
|
|
b: float = Field(description="second number")
|
|
operator: str = Field(description="operator to use (e.g., +, -, *, /, ^)")
|