<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Function Calling on Chang Luo</title>
		<link>https://www.luochang.ink/tags/function-calling/</link>
		<description>Recent content in Function Calling on Chang Luo</description>
		<generator>Hugo</generator>
		<language>zh-CN</language>
		
		
		
		
			<lastBuildDate>Sun, 15 Jun 2025 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://www.luochang.ink/tags/function-calling/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Agent 实战：智能路由、任务拆解和链路工程</title>
				<link>https://www.luochang.ink/posts/agent_project/</link>
				<pubDate>Sun, 15 Jun 2025 00:00:00 +0000</pubDate>
				<guid>https://www.luochang.ink/posts/agent_project/</guid>
				<description>&lt;blockquote&gt;&#xA;&lt;p&gt;大模型天生具有幻觉，为了工程的准确性，我们奉行“非必要不Agent”原则。我们是专业的，除非忍不住，否则绝不用 Agent。&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;特别声明：本文使用 &lt;a href=&#34;https://github.com/QwenLM/Qwen-Agent&#34;&gt;Qwen Agent&lt;/a&gt; 实现。&lt;/p&gt;&#xA;&lt;p&gt;本文包含以下两个项目：&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1）智能路由&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;概述&lt;/strong&gt;：如果一个业务可以分很多种情况处理。针对每种情况，我们开发一个工具函数 (Function Calling)，来处理此种情况内部的复杂性。此时，Agent 充当智能路由的角色，将对应的情况路由到对应的工具函数。工具函数内部带有描述信息，Agent 可以访问这些信息，以此判断在何种情况下，调用这个工具函数。&lt;/p&gt;&#xA;&lt;p&gt;具体来讲，本项目开发了一个 &lt;strong&gt;客诉核查 Agent&lt;/strong&gt;。针对 物流逾期 和 假货 两种客诉，分别开发了对应的工具函数。&lt;strong&gt;Agent 通过接入工具函数，获得了核查以上两种客诉真实性的能力&lt;/strong&gt;。当我们将客诉信息传递给 Agent，它会输出针对该客诉的 &lt;strong&gt;核查结论&lt;/strong&gt; 和 &lt;strong&gt;相应证据&lt;/strong&gt;。&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2）数据库查询优化&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;概述&lt;/strong&gt;：数据库查询是一个非常通用的需求，其中 &lt;strong&gt;NL2SQL&lt;/strong&gt; 是难点。为了提升 NL2SQL 的准确性，很容易想到把数据表的 Schema、样例数据、个别字段的枚举值作为上下文 (context) 注入到原始 Prompt 中。本项目实现了这一点。&lt;/p&gt;&#xA;&lt;p&gt;具体来说，本项目做了以下工作：&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;启用 Qwen Agent 的 &lt;strong&gt;ReActChat&lt;/strong&gt; 模式，以提升多步骤情况下的性能&lt;/li&gt;&#xA;&lt;li&gt;开发定制的 &lt;strong&gt;Workflow&lt;/strong&gt;，用于将 Schema 等上下文信息注入原始 Prompt 中&lt;/li&gt;&#xA;&lt;li&gt;开发可流式对话的 &lt;strong&gt;Gradio WebUI&lt;/strong&gt;，以方便调试 Agent 和 Workflow&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;✨ 所有代码见 GitHub 仓库：&lt;a href=&#34;https://github.com/luochang212/agent-project&#34;&gt;luochang212/agent-project&lt;/a&gt;&lt;/p&gt;&#xA;&lt;!-- - 智能路由代码见：[intelligent_routing](https://github.com/luochang212/agent-project/tree/main/intelligent_routing)&#xA;- 数据库查询优化代码见：&#xA;    - Agent: [gradio_postgres_agent.py](https://github.com/luochang212/agent-project/blob/main/gradio_postgres_agent.py)&#xA;    - Workflow: [gradio_postgres_workflow.py](https://github.com/luochang212/agent-project/blob/main/gradio_postgres_workflow.py) --&gt;&#xA;&lt;h2 id=&#34;一引言&#34;&gt;一、引言&lt;/h2&gt;&#xA;&lt;h3 id=&#34;1-尚未到来的涌现&#34;&gt;1. 尚未到来的涌现&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We always overestimate the change that will occur in the next two years and underestimate the change that will occur in the next ten. &amp;ndash; Bill Gates&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
