当前位置: 首页 > news >正文

广州建站网站前十名/广东广州网点快速网站建设

广州建站网站前十名,广东广州网点快速网站建设,深圳vi设计公司联系,社会题目可以在哪些网站上做​一、软件介绍 文末提供程序和源码下载 Agent Builder API - Agent Smith 扩展的后端服务(开源代码)手动设置:在本地计算机中克隆此存储库并启动 python FAST API 服务器。(可选)安装并设置 Mongo DB。Dev Container…

​一、软件介绍

文末提供程序和源码下载

        Agent Builder API - Agent Smith 扩展的后端服务(开源代码)手动设置:在本地计算机中克隆此存储库并启动 python FAST API 服务器。(可选)安装并设置 Mongo DB。Dev Container 设置:Dev Containers 允许您自动执行环境设置。使用此设置可在预安装了扩展的隔离环境中安装和运行容器服务。您还可以使用密钥在远程环境/浏览器中打开 GitHub Codespaces 以传递模型 API 密钥。

二、Manual Setup 手动设置

  1. Set up a Python virtualenv and install dependencies
    设置 Python virtualenv 并安装依赖项

    python -m venv --prompt agent-builder-api venv
    source venv/Scripts/activate
    # venv/Scripts/activate (Windows PS)
    pip install -r requirements.txt
  2. Set the model name and API key in .env file
    在 .env 文件中设置模型名称和 API 密钥

    OPENAI_API_KEY="sk----"
    MODEL_NAME="openai"
  3. Start the server in the new terminal
    在新终端中启动服务器

    python -m agentbuilder.main
[Optional] Start using Poetry
[可选]开始使用 Poetry

For fine-grained dependency management, use Poetry to pick and choose dependency packs based on your LLM model provider and tool features.
对于精细的依赖项管理,请使用 Poetry 根据您的LLM模型提供程序和工具功能来挑选依赖项包。

  1. Follow the Offical Instruction Guide to install Poetry.
    按照 官方说明指南安装 Poetry。

  2. Pick and choose dependency packs to install.
    选择要安装的依赖项包。

    poetry install --extras "mcp openai gemini cohere anthropic mongodb vectordb langgraph guardrails ui"
  3. Set the model name and API key in .env file
    在 .env 文件中设置模型名称和 API 密钥

    OPENAI_API_KEY="sk----"
    MODEL_NAME="openai"
  4. Start the server in the new terminal
    在新终端中启动服务器

    poetry run start-server

Note 注意

Poetry will create a virtual environment for us.
诗歌将为我们创造一个虚拟环境。

MCP servers MCP 服务器
  • Local MCP servers can be added in MCP server folder
    可以在 MCP 服务器文件夹中添加本地 MCP 服务器

  • Multiple MCP clients can be configured in MPC client file
    可以在 MPC 客户端文件中配置多个 MCP 客户端

    mcp_servers={"math": {"command": sys.executable,"args": [f"{current_dir}\\servers\\math.py"],"transport": "stdio",}}
[Optional] Enable MongoDB
[可选]启用 MongoDB

By default, data is stored as JSON files. Enable storage in Mongo DB by setting url using the environment variable.
默认情况下,数据存储为 JSON 文件。通过使用环境变量设置 url 在 Mongo DB 中启用存储。

MONGODB_URL="mongodb://localhost:27017/llmdb"

三、Dev Containers Setup 开发容器设置

  1. Enable Dev Containers in vscode by following the steps in official documentation.
    按照官方文档中的步骤在 vscode 中启用 Dev Containers。

  2. Click on the badge below to run the services in an isolated container environment in a local machine.
    单击下面的徽章,在本地计算机的隔离容器环境中运行服务。

    This will clone the repo and start the API and Mongo DB container services.
    这将克隆存储库并启动 API 和 Mongo DB 容器服务。

Tip 提示

Use URL mongodb://mongodb:27017/llmdb in Mongo DB vscode extension to view storage data.
使用 Mongo DB vscode 扩展中的 URL mongodb://mongodb:27017/llmdb 查看存储数据。

  1. Execute F1 > Dev Containers: Attach to Running Container.. and select agent-builder-container.
    执行 F1 > Dev Containers:附加到正在运行的容器..,然后选择 agent-builder-container。

  2. Set the model name and API key in .env file
    在 .env 文件中设置模型名称和 API 密钥

    OPENAI_API_KEY="sk----"
    MODEL_NAME="openai"

四、Customization 定制

Dependency packs and environment configuration
依赖项包和环境配置

Dependency packs allow fine-grained package installations based on your requirements. Use the environment variable EXTRA_DEPS in the docker-compose file to update.
依赖项包允许根据您的要求进行精细的软件包安装。使用 docker-compose 文件中的环境变量 EXTRA_DEPS 进行更新。

install-extra-deps.sh script can be used in dev container mode if docker-compose is not available.
如果 docker-compose 不可用,则可以 install-extra-deps.sh Dev Container 模式下使用该脚本。

For example, the below environment configuration will install dependencies for the Gemini model, Mongo DB, Langchain Graph, and VectorDB
例如,以下环境配置将安装 Gemini 模型、Mongo DB、Langchain Graph 和 VectorDB 的依赖项

EXTRA_DEPS: "gemini,mongodb,langgraph,vectordb"

Tip 提示

Start with a basic dependency pack to support your model and add other features incrementally
从基本依赖项包开始以支持您的模型,并逐步添加其他功能

The following models are supported by its dependency pack
其依赖项包支持以下模型

Model 型Dependency pack 依赖项包ENV key name ENV 密钥名称
OPEN AI 开放人工智能openai OpenAI 公司OPENAI_API_KEY
GEMINI 双子座gemini 双子座GOOGLE_API_KEY
COHEREcohere 凝聚COHERE_API_KEY
ANTHROPIC ANTHROPIC 类anthropic 人为的ANTHROPIC_API_KEY

Some pre-configured tools require extra dependencies or API keys to get enabled.
某些预配置工具需要额外的依赖项或 API 密钥才能启用。

Tool 工具Dependency pack 依赖项包ENV key name ENV 密钥名称
internet_search-TAVILY_API_KEY
vectorstore_searchvectordb 矢量数据库EMBED_MODEL_NAME

Adding Tools 添加工具

Add custom Tools or Toolkits using tool factory module (agentbuilder/factory/tool_factory).
使用工具工厂模块 (agentbuilder/factory/tool_factory) 添加自定义工具或工具包。

  1. Create your tool 创建您的工具

    agentbuilder/tools/my_custom_tool.py
    代理构建器/工具/my_custom_tool.py

    from pathlib import Path
    from langchain_core.tools import tool
    from pydantic import BaseModel, Field@tool
    def my_custom_tool(a: int, b: int):
    """Custom Tool Description"""
    return a + bmy_custom_tool.name="custom_tool_name"
    my_custom_tool.description="Custom Tool Description"class field_inputs(BaseModel):
    a: int = Field(description="First input")
    b: int = Field(description="Second input")my_custom_tool.args_schema = sum_inputs
    my_custom_tool.metadata= {"file_path": str(Path(__file__).absolute())}
  2. Add your tool in get_all_tools method in tool_factory module.
    在 get_all_tools 模块tool_factory方法中添加您的工具。

    agentbuilder/factory/tool_factory.py
    代理生成器/工厂/tool_factory.py

    def get_all_tools()->Sequence[BaseTool]:return get_vectordb_tools()+ get_websearch_tools() + json_tools + [directly_answer_tool,weather_clothing_tool,temperature_tool,temperature_sensor_tool,sum_tool,greeting_tool,git_diff_tool,repl_tool,
    +           my_custom_tool]

Adding Agents 添加代理

Agents can be created using Extension UI or declared in code. Add your agents using the Agent Factory Module (agentbuilder/factory/agent_factory).
代理可以使用扩展 UI 创建,也可以在代码中声明。使用 Agent Factory 模块 (agentbuilder/factory/agent_factory) 添加代理。

  1. Create your agent 创建您的代理

    def my_agent():return AgentParams(name="my_agent",preamble= "You are a powerful agent that uses tools to answer Human questions",tools=  ["my_custom_tool"],agent_type= 'tool_calling')
  2. Add your agent in get_all_agents method.
    在 get_all_agents 方法中添加代理。

    def get_all_agents():
    return [default_agent(),weather_agent(),python_agent(),git_agent(),
    +       my_agent()
    ]

Custom Agent Builder and Graphs
自定义代理生成器和图表

Customize your Agent Workflow using custom prompts and graphs. Filter the agent using the agent name to apply customizations.
使用自定义提示和图表自定义您的代理工作流程。使用代理名称筛选代理以应用自定义。

For example, the following code applies graph builder workflow for the Agent named "graph_agent"
例如,以下代码将图形生成器工作流应用于名为“graph_agent”的代理

def get_agent_builder(params:AgentBuilderParams):agent_name= params.namematch agent_name:case "graph_agent":from agentbuilder.agents.BaseGraphAgentBuilder import BaseGraphAgentBuilderreturn BaseGraphAgentBuilder(params)case _:return BaseAgentBuilder(params)

Important 重要

Dependency pack "langgraph" needs to be installed for BaseGraphAgentBuilder.
需要为 BaseGraphAgentBuilder 安装依赖项包 “langgraph”。

Configuring models 配置模型

Update model configuration using environment variables.
使用环境变量更新模型配置。

Supports {Provider}/{ModelName} format
支持 {Provider}/{ModelName} 格式

  • Gemini 双子座

    Create API keys https://aistudio.google.com/app/apikey
    创建 API 密钥 https://aistudio.google.com/app/apikey

     MODEL_NAME="gemini/gemini-pro"EMBED_MODEL_NAME="gemini/embedding-001"GOOGLE_API_KEY=<GOOGLE_API_KEY>
  • Cohere 凝聚

    Create API keys Login | Cohere
    创建 API 密钥 https://dashboard.cohere.com/api-keys

     MODEL_NAME="cohere/command"EMBED_MODEL_NAME="cohere/embed-english-v3.0"COHERE_API_KEY=<COHERE_API_KEY>
  • Open AI 打开 AI

    Create API keys https://platform.openai.com/docs/quickstart/account-setup
    创建 API 密钥 https://platform.openai.com/docs/quickstart/account-setup

     MODEL_NAME="openai/gpt-4o"EMBED_MODEL_NAME="openai/text-embedding-3-large"OPENAI_API_KEY=<OPENAI_API_KEY>
  • Anthropic 人

    Create API keys Home \ Anthropic and Voyage AI | Home
    创建 API 密钥 https://www.anthropic.com/ 和 https://www.voyageai.com/

     MODEL_NAME="anthropic/claude-3-opus-20240229"EMBED_MODEL_NAME="voyageai/voyage-2"ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY>VOYAGE_API_KEY=<VOYAGE_API_KEY>
  • Ollama 奥拉马

    Use local models for function calls.
    使用本地模型进行函数调用。

    [!TIP] Use JSON chat agent type for better compatibility with local models.
    [!提示] 使用 JSON 聊天代理类型以更好地与本地模型兼容。

    Install Ollama and pull the model.
    安装 Ollama 并拉取模型。

    ollama pull mistral:v0.3

    Set environment variable.
    设置环境变量。

    MODEL_NAME="ollama/mistral:v0.3"

五、软件下载

夸克网盘分享

本文信息来源于GitHub作者地址:https://github.com/nagaraj-real/agent-builder-api

http://www.whsansanxincailiao.cn/news/32006154.html

相关文章:

  • 网站建设数据库系统/纵横seo
  • 中国3大做外贸的网站/东莞seo建站优化工具
  • 什么样的公司愿意做网站/爱站网seo综合查询
  • 宁波网络推广平台/系统优化大师
  • 烟台网站建设ytwzjs/开通网站需要多少钱
  • png素材网站/推广平台app
  • 微信三级分销系统/网站搜索排优化怎么做
  • b2b电子商务网站的收益模式主要有/百度推广怎么赚钱
  • 网站制作什么品牌好/东莞网络推广哪家公司奿
  • 哪个网站可以做化学实验/网络营销的优缺点
  • 电影网站嵌入广告怎么做Java/营销软文怎么写
  • 403.14网站/网络推广公司是做什么的
  • 网站开发软件培训/如何做网站优化seo
  • 网站建设的/西安做网站哪家好
  • 互联网工具型网站/提高网站排名的软件
  • 网站做图片的大小/百度seo还有前景吗
  • 国家政府网站/网站设计公司上海
  • 派设计包装设计网站/下载安装百度一下
  • 做网站付多少定金/百度竞价推广登陆
  • 网络专题策划方案/seo快排
  • 网站标题怎么隔开/网推什么平台好用
  • 济南建设设备安装有限责任公司官网/郑州seo顾问培训
  • 界面设计是什么专业/百度seo泛解析代发排名
  • 营销策划公司有哪些职位/关键词优化怎么操作
  • 企业网站方案/网络推广一般都干啥
  • 微信网站链接怎么做/成功的网络营销案例有哪些
  • 伊利集团网站建设实训/微信群推广平台有哪些
  • 企业级网站开发平台/企业网站营销的典型案例
  • 教做衣服的网站/电商网站卷烟订货流程
  • 有服务器域名源码怎么做网站平台/北京建站优化