diff --git a/cookbook/simple_demo/messages.jsonl b/cookbook/simple_demo/messages.jsonl
index 099d8e99..99475cba 100644
--- a/cookbook/simple_demo/messages.jsonl
+++ b/cookbook/simple_demo/messages.jsonl
@@ -1,50 +1,56 @@
[
{
"role": "user",
- "content": "You are a helpful assistant.\nThe current time is 2025-07-21 15:01:21.\nPlease proactively choose the most suitable tool or combination of tools based on the user's question, including python_execute,web_search,terminate etc.\nPlease first think about how to break down the problem into subtasks, what tools and parameters should be used for each subtask, and finally provide the tool call name and parameters.\nTry calling the same tool multiple times with different parameters to obtain information from various perspectives.\nPlease determine the response language based on the language of the user's question.\n\n# User's Question\nAnalyze Xiaomi Corporation\n",
+ "content": "You are a helpful assistant.\nThe current time is 2025-08-29 01:42:07.\nPlease proactively choose the most suitable tool or combination of tools based on the user's question, including web_search,python_execute,terminate etc.\nPlease first think about how to break down the problem into subtasks, what tools and parameters should be used for each subtask, and finally provide the tool call name and parameters.\nTry calling the same tool multiple times with different parameters to obtain information from various perspectives.\nPlease determine the response language based on the language of the user's question.\n\nAnalyze Xiaomi Corporation\n",
"reasoning_content": "",
"tool_calls": [],
"tool_call_id": "",
+ "time_created": "2025-08-29 01:42:07",
"metadata": {}
},
{
"role": "assistant",
- "content": "To analyze Xiaomi Corporation, we can break down the task into several subtasks:\n\n1. **Overview of Xiaomi Corporation**: Gather general information about the company, such as its history, mission, and main products.\n2. **Financial Performance**: Look into the financial health and performance of Xiaomi Corporation, which includes revenue, profit margins, etc.\n3. **Market Position**: Understand Xiaomi's standing in the market compared to its competitors.\n4. **Recent News/Developments**: Collect recent news articles or press releases about Xiaomi to understand any current events affecting the company.\n5. **Future Outlook**: Summarize any strategic plans or forecasts for Xiaomi’s future.\n\nFor each subtask, I will use the appropriate tools and parameters as follows:\n\n### Subtask 1: Overview of Xiaomi Corporation\n- **Tool:** web_search\n- **Parameters:** {\"query\": \"Xiaomi Corporation overview\"}\n\n### Subtask 2: Financial Performance\n- **Tool:** web_search (to find the latest financial reports)\n- **Parameters:** {\"query\": \"Xiaomi Corporation financial performance 2025\"}\n- **Tool:** python_execute (if numerical data needs analysis)\n- **Parameters:** Will be determined based on available data\n\n### Subtask 3: Market Position\n- **Tool:** web_search\n- **Parameters:** {\"query\": \"Xiaomi Corporation market position 2025\"}\n\n### Subtask 4: Recent News/Developments\n- **Tool:** web_search\n- **Parameters:** {\"query\": \"Xiaomi Corporation recent news 2025\"}\n\n### Subtask 5: Future Outlook\n- **Tool:** web_search\n- **Parameters:** {\"query\": \"Xiaomi Corporation future outlook 2025\"}\n\nLet's start with the first subtask.\n\n### Calling Tools for Subtask 1\n\nI will now call the `web_search` function with the query \"Xiaomi Corporation overview\" to gather general information about Xiaomi Corporation.",
- "reasoning_content": "",
+ "content": "",
+ "reasoning_content": "Okay, let's tackle this user query about analyzing Xiaomi Corporation. First, I need to figure out what the user is asking for. They just said \"Analyze Xiaomi Corporation,\" so it's pretty broad. I should break this down into subtasks.\n\nHmm, analyzing a company usually involves looking at their financials, market position, product lines, maybe recent news or trends. But since I don't have real-time data, I need to use web search to get the latest info. The user might want current data, so web_search is probably the first tool to use.\n\nWait, the user mentioned the current time is 2025-08-29, but that's probably a placeholder. The actual date isn't relevant here. I should focus on getting the latest info about Xiaomi.\n\nFirst, I'll need to search for key aspects of Xiaomi. Let me think of relevant keywords. Maybe \"Xiaomi Corporation financial performance 2024\", \"Xiaomi market share smartphone 2024\", \"Xiaomi recent products 2024\", and \"Xiaomi global expansion strategy\". Using multiple search terms will give a more comprehensive analysis.\n\nWait, the tools say if there are multiple keywords, use each separately. So I should make four separate web_search calls with each keyword. Let me check the function description again. Yes, \"if there are multiple search keywords, please use each keyword separately to call this tool.\"\n\nSo, I'll generate four tool calls with each query. Let me list them:\n\n1. \"Xiaomi Corporation financial performance 2024\"\n2. \"Xiaomi market share smartphone 2024\"\n3. \"Xiaomi recent products 2024\"\n4. \"Xiaomi global expansion strategy\"\n\nEach of these will get different pieces of information. Once I have the search results, I can compile the analysis. But since I can't do that yet, the next step is to make those web searches.\n\nWait, the user might not need all four, but to be thorough, it's better to cover different angles. Let me confirm if these keywords are appropriate. Financial performance, market share, recent products, and expansion strategy are all key areas for a company analysis.\n\nI should make sure the queries are specific to 2024 since the current time in the system is 2025, but the user's query is for analysis, so recent data is needed. Using 2024 in the query makes sense.\n\nSo, I'll proceed to call web_search four times with each of those keywords. Then, once the results come back, I can synthesize the information. But since I can't do that now, the immediate action is to make those four tool calls.\n",
"tool_calls": [],
"tool_call_id": "",
+ "time_created": "2025-08-29 01:42:15",
"metadata": {}
},
{
"role": "user",
- "content": "\n**Xiaomi Corporation Overview** \n\nXiaomi Corporation, founded in April 2010, is a consumer electronics and smart manufacturing company listed on the Main Board of the Hong Kong Stock Exchange (July 9, 2018). Its core business focuses on smartphones, smart hardware connected via an IoT platform, and innovative consumer electronics solutions. \n\nKey aspects include: \n1. **Business Growth & Challenges**: Rapid expansion has led to challenges in system performance, fault recovery, and operational costs for critical business systems. \n2. **Technological Advancements**: \n - Adopted **OceanBase**, a distributed database, to upgrade smart manufacturing systems. Pilot systems have operated stably for months, achieving 2-3x performance improvements, high availability, and reduced costs. \n - Developed products like the **Xiaomi TV A Pro 43/55 2025** series, featuring 4K QLED displays, Dolby Vision®, HDR10+, Dolby Atmos®, and integration with Google TV™ for immersive entertainment. \n3. **Product Innovation**: \n - Offers devices such as the **Xiaomi TV Box S (2nd Gen)** with 4K Ultra HD, Dolby Vision®, and DTS-HD audio. \n - Introduced the **Xiaomi Mijia Constant Temperature Electric Kettle** with advanced temperature control and energy efficiency. \n\nXiaomi continues to prioritize smart manufacturing, IoT integration, and high-performance distributed database solutions to support its global market presence.\n\n\n根据知识库中提供的信息,关于 **Xiaomi Corporation(小米集团)2025 年的财务表现**,目前可获取的直接相关内容如下:\n\n---\n\n### **1. 小米 2024 年财报亮点及 2025 年业务展望** \n> **Xiaomi Posts Best Ever Annual Earnings Report, Lifts 2025 Auto** \n> - **财务表现**:小米 2024 年财报刷新年度记录,单季度营收首次突破 **1000 亿元人民币**,创历史最佳年度财报。 \n> - **业务进展**:电动汽车(EV)业务进展迅速,首款车型交付量达到 10 万辆仅用 229 天,而实现交付量翻倍(20 万辆)仅需 110 天,增速显著。 \n> - **2025 年计划**:CEO 雷军对电动汽车业务持乐观态度,计划推出更高性能的“超跑版”车型(hypercar variant),并进一步扩大 EV 市场份额。 \n\n---\n\n### **2. 关键信息总结** \n- **财务增长**:小米 2024 年营收和利润均创历史新高,但具体 2025 年财务数据(如收入、利润率等)未在知识库中披露。 \n- **战略重点**:2025 年核心增长动力来自电动汽车业务扩张及 AIoT 设备(如智能穿戴、智能家居)的持续布局。 \n\n---\n\n### **备注** \n知识库中未包含小米 2025 年全年完整财务数据,上述内容基于 2024 年财报及业务动态的公开信息。如需更详细数据,建议参考小米官方发布的 2025 年年度报告或最新季度财报。 \n\n--- \n以上内容均直接引用自知识库中的原始文本,未进行额外推断。\n\n\nThe following information from the provided context relates to Xiaomi Corporation's market position in 2025: \n\n1. **Financial and Operational Performance**: \n - Xiaomi Group announced its **2024 annual results** on March 18, 2025, with a total revenue of **RMB 365.9 billion** in 2024. \n - The company reported **686 million monthly active users** globally for its smartphones and tablets, and **904.6 million connected IoT devices** as of 2024. \n\n2. **Market Presence**: \n - Xiaomi operates as a leading consumer electronics and smart manufacturing company centered on smartphones, smart hardware, and IoT platforms. \n - The company continues to emphasize innovation, quality, and affordability, aiming to \"allow everyone in the world to enjoy a better life through technology.\" \n\n3. **Strategic Developments**: \n - In March 2025, Xiaomi raised **HKD 42.5 billion** through a share placement (800 million shares), likely supporting its strategic initiatives. \n - Xiaomi entered the electric vehicle sector in 2021 and unveiled a new logo, signaling diversification into emerging markets. \n\n4. **Upcoming Financial Updates**: \n - Xiaomi scheduled its **Q1 2025 earnings release** on May 27, 2025, followed by an investor call to discuss financial performance and future plans. \n\n5. **Global and Regional Market Trends**: \n - While not directly tied to Xiaomi, reports on global markets like Wi-Fi 6 and electric pressure cookers (e.g., projected **CAGR of 3.08%** for the global electric pressure cooker market by 2032) highlight technological trends Xiaomi may leverage. \n\nNo explicit 2025 market share or ranking data is provided in the context, but Xiaomi's focus on AIoT, smartphones, and expansion into automotive suggests a competitive position in key growth areas.\n\n\nHere are the recent 2025 updates about Xiaomi Corporation from the provided context: \n\n### **1. Xiaomi Smart Doorbell 4 Pro Launch (July 20, 2025)** \n- Xiaomi released the **Xiaomi Smart Doorbell 4 Pro** at a discounted price of **¥394** (RMB). \n\n---\n\n### **2. Q1 2025 Financial Results (May 27, 2025)** \n- **Revenue**: ¥111.3 billion (RMB), up **47.4% YoY**. \n- **Adjusted Net Profit**: ¥10.7 billion (RMB), a record high and up **64.5% YoY**. \n- **Key Highlights**: \n - Smartphone business revenue: ¥50.6 billion (RMB), up **8.9% YoY**. \n - IoT and lifestyle products revenue: ¥32.3 billion (RMB), up **58.7% YoY**. \n - EV and AI innovation business revenue: ¥18.6 billion (RMB). \n - **Xiaomi SU7 series** delivered **75,869 units** in Q1 2025. \n - Smartphone shipments in Mainland China reached **18.8% market share** (ranked #1). \n\n---\n\n### **3. Product Launches and Innovations** \n- **Xiaomi SU7 Ultra**: Launch scheduled for **July 2025** with an 835 km range and enhanced safety features. \n- **Xiaomi TV 50-inch 2025 Model**: Priced at **¥1,199** (RMB) on JD.com (as of March 22, 2025). \n- **AI and Chip Development**: \n - Launched the **Xiaomi mo** open-source large model for inference. \n - Released the **3nm flagship smartphone SoC chip Xiaomi Xuanji o1**, ranking among the global leaders in performance. \n\n---\n\n### **4. Strategic Developments** \n- **R&D Investment**: Xiaomi plans to invest **¥200 billion (RMB)** in R&D from 2025–2030, with **¥13.5 billion (RMB)** already spent from 2021–2024. \n- **Global Expansion**: \n - Xiaomi SU7 became the **top-selling model in China above ¥200,000** (price tier). \n - Expanded offline presence to **16,000 Xiaomi Home stores** and **235 EV sales outlets** in Mainland China. \n\n---\n\n### **5. Upcoming Events** \n- **2024 Annual Report Release**: Scheduled for **March 18, 2025**, with an investor call discussing financial performance and future plans. \n\nFor detailed investor updates, visit Xiaomi’s official **Investor Relations website** or review the Q1 2025 earnings call transcript.\n\n\nFrom the provided context: \n\n**小米网络营销的创新之路与突破之策** \n摘要: 当前小米面临多重挑战:智能手机市场增量收窄,友商等竞品加剧竞争;性价比定位制约品牌高端化进程;线下渠道覆盖与服务效率待优化;新生代消费需求向场景化、情感化迁移。未来,网络营销呈多元、智能、个性趋势,小米需加大研发,推出创新产品,发挥营销与产品相辅相成的作用,不断创新,以在网络营销上取得更大成就,为行业发展做贡献。 \n\nThis indicates that Xiaomi's 2025 outlook involves addressing challenges like market saturation, brand premiumization, and offline channel optimization, while focusing on innovation, R&D, and adapting to trends in personalized and intelligent marketing.\n\nThink based on the current content and the user's question: Is the current context sufficient to answer the user's question? \n\n- If the current context is not sufficient to answer the user's question, consider what information is missing. \n Re-plan and think about how to break down the missing information into subtasks. \n For each subtask, determine what tools and parameters should be used for the query.\n Please first provide the reasoning process, then give the tool call name and parameters.\n\n- If the current context is sufficient to answer the user's question, use the **terminate** tool.\n Please determine the response language based on the language of the user's question.\n",
+ "content": "\n- Xiaomi's smartphone revenue reached CNY 191.8 billion ($26.5 billion), accounting for 52% of overall sales. Xiaomi sold 169 million units in 2024.\n- Total Revenue for 2024 was RMB 365.9 billion.\n- Xiaomi posted record-breaking financial results for 2024, with the CEO Lei Jun calling it the \"strongest annual report in history.\"\n- Revenue for the first quarter of 2025 surged 47.4 percent year-on-year to 111.3 billion yuan ($15.5 billion), indicating continued strong performance following 2024.\n\n\nHere is the relevant information regarding Xiaomi's smartphone market share in 2024:\n\n1. In Q1 2025, Xiaomi's smartphone revenue is mentioned, and it reclaimed the top spot in mainland China after a decade, capturing 18.8% market share. (Note: Though mentioned in Q1 2025, it indicates Xiaomi's strong performance that might have carried over from 2024.)\n\n2. In 2024 Q4, Xiaomi's market share of smartphone shipments in mainland China increased by 3.0 percentage points YoY to 15.8%, marking its 4 consecutive quarters of market share growth.\n\n3. Additionally, in the RMB3,000 - 4,000 segment in 2024 Q3, Xiaomi's market share reached 18.1%, up 9.3 percentage points YoY.\n\nThese data points reflect Xiaomi's growing market presence in the Chinese smartphone market during 2024.\n\n\nIn 2024, Xiaomi has released several new products across different categories:\n\n- **Xiaomi 15 Series and Xiaomi HyperOS 2**: On October 29, 2024, Xiaomi held a new product launch event, introducing the Xiaomi 15 series smartphones and the Xiaomi HyperOS 2. The Xiaomi 15 series includes four color options, starting at a price of 4499 yuan. Two special editions, the Custom Edition and the Diamond Limited Edition, are priced at 4999 yuan and 5999 yuan, respectively. These smartphones are equipped with the latest Snapdragon 8 Gen 3 processor, featuring enhanced performance and energy efficiency. Additionally, the Xiaomi 15 series boasts improved Leica optical high-speed lens systems and the advanced Xiaomi AISP 2.0 computational photography platform powered by large models.\n\n- **Xiaomi SU7 Ultra Production Version**: As part of the October 29 launch event, Xiaomi also unveiled the Xiaomi SU7 Ultra production version, which is described as the fastest four-door production car available on the streets, capable of accelerating from 0 to 100 km/h in just 1.98 seconds. The pre-sale price is set at 814,900 yuan, with an expected official release in March 2025.\n\n- **Xiaomi Watch S4 and Xiaomi Band 9 Pro**: These wearable devices were also introduced during the October 29 event, contributing to Xiaomi's ecosystem of interconnected devices.\n\n- **Xiaomi MIX Fold4 and Xiaomi MIX Flip**: During a summer product launch event on July 19, Xiaomi introduced the Xiaomi MIX Fold4 and Xiaomi MIX Flip. The Xiaomi MIX Fold4 is noted for its lightweight and slim design, weighing 226g and having a single-edge thickness of 4.59mm. It features Xiaomi's latest Dragon Bone Hinge 2.0 design, ensuring stability and safety over 500,000 folding tests. The Xiaomi MIX Flip is a compact foldable phone with a width of only 74.02mm and a weight of 192g, ideal for one-handed operation.\n\n- **Redmi K70 Ultra**: Also launched on July 19, this smartphone is equipped with the Dimensity 9300+ processor and an independent graphics card D1, achieving a benchmark score exceeding 2.38 million in performance tests.\n\n- **Xiaomi 14 Ultra**: This device was introduced as an annual imaging flagship in February 2024, featuring a Leica-tuned quad-camera system that pushes image quality to new extremes.\n\n- **Xiaomi 14T Series**: At an international launch event in September 2024, Xiaomi showcased the professional night photography capabilities of the Xiaomi 14T series, capable of capturing true-to-life colors in low-light conditions.\n\nThese products highlight Xiaomi's commitment to innovation and technological advancement across multiple product lines and markets.\n\n\nXiaomi's global expansion strategy involves several key elements:\n\n1. **Market Positioning and Branding**: Xiaomi's success in the global market is attributed to its precise market positioning, localization strategies, and strong brand building.\n\n2. **International Market Entry**: By 2016, Xiaomi had started to expand internationally, aiming to make \"good but cheap things\" and replicate its domestic success in new markets.\n\n3. **Product Ecosystem**: The company aggressively built a robust ecosystem around its products, which included selling over 70 million mobile phones in 2015.\n\n4. **Leadership**: Hugo Barra, a top Android executive, left Google a few years earlier to lead Xiaomi’s international growth.\n\n5. **Shipping and Logistics**: Enhancing customer satisfaction through timely deliveries and optimizing time-to-market for new product launches are integral to Xiaomi's global strategy.\n\n6. **Localization Strategies**: Xiaomi employs localization strategies to better fit the markets it enters, which helps in achieving a higher global market share.\n\n7. **Global Market Share**: Xiaomi's global market share has hit a new high of 27%, indicating the effectiveness of its expansion strategies.\n\nThink based on the current content and the user's question: Is the current context sufficient to answer the user's question? \n\n- If the current context is not sufficient to answer the user's question, consider what information is missing. \n Re-plan and think about how to break down the missing information into subtasks. \n For each subtask, determine what tools and parameters should be used for the query.\n Please first provide the reasoning process, then give the tool call name and parameters.\n\n- If the current context is sufficient to answer the user's question, use the **terminate** tool.\n",
"reasoning_content": "",
"tool_calls": [],
"tool_call_id": "",
+ "time_created": "2025-08-29 01:42:41",
"metadata": {}
},
{
"role": "assistant",
- "content": "Based on the gathered information through the `web_search` tool, we have obtained a comprehensive analysis of Xiaomi Corporation covering multiple aspects:\n\n### Overview of Xiaomi Corporation\n- **Founded**: April 2010.\n- **Core Business**: Smartphones, smart hardware connected via an IoT platform, and innovative consumer electronics solutions.\n- **Technological Advancements**: Adoption of OceanBase distributed database for smart manufacturing systems, various product innovations including TVs and electric kettles.\n\n### Financial Performance\n- **2024 Annual Results**: Total revenue of RMB 365.9 billion.\n- **Monthly Active Users**: 686 million globally for smartphones and tablets.\n- **Connected IoT Devices**: 904.6 million as of 2024.\n- **Q1 2025 Financial Highlights**:\n - Revenue: ¥111.3 billion (up 47.4% YoY).\n - Adjusted Net Profit: ¥10.7 billion (record high, up 64.5% YoY).\n - Key growth areas include smartphone business, IoT products, and EV innovation.\n\n### Market Position\n- Leading consumer electronics and smart manufacturing company.\n- Focus on innovation, quality, and affordability.\n- Expansion into new markets like electric vehicles with significant delivery milestones.\n\n### Recent News/Developments\n- Launch of **Xiaomi Smart Doorbell 4 Pro**.\n- Introduction of **Xiaomi SU7 series** delivering 75,869 units in Q1 2025.\n- Upcoming launch of **Xiaomi SU7 Ultra** with advanced features.\n- Investment in R&D and global expansion plans.\n\n### Future Outlook\n- Challenges include market saturation, brand premiumization, and offline channel optimization.\n- Strategies involve increased R&D investment, launching innovative products, and adapting to personalized and intelligent marketing trends.\n\nGiven this detailed analysis, I believe the current context is sufficient to answer the user's question about analyzing Xiaomi Corporation.\n\n### Tool Call",
- "reasoning_content": "",
+ "content": "\nThe user's query to \"Analyze Xiaomi Corporation\" has been addressed comprehensively using the provided data from web searches. The analysis covers:\n1. **Financial Performance** (2024 revenue, smartphone sales, Q1 2025 growth)\n2. **Market Share** (China smartphone dominance, segment-specific performance)\n3. **Product Portfolio** (2024 flagship launches across smartphones, EVs, wearables)\n4. **Global Strategy** (market expansion, localization, 27% global market share)\n\nAll key aspects of a company analysis are covered with current data (2024-2025). No additional information is required.\n\n\n\nThe analysis of Xiaomi Corporation for 2024-2025 is complete, based on the following key findings:\n\n✅ **Financials**: \n- Total Revenue: RMB 365.9 billion (2024)\n- Smartphone Revenue: RMB 191.8 billion (52% of total sales)\n- 169 million smartphones sold in 2024\n- Q1 2025 Revenue: RMB 111.3 billion (+47.4% YoY)\n\n✅ **Market Position**:\n- China smartphone market share: 15.8% (Q4 2024), 18.8% (Q1 2025)\n- Top segment performance: 18.1% in RMB 3,000-4,000 range (Q3 2024)\n\n✅ **Product Innovation**:\n- Xiaomi 15 Series (Oct 2024) with Snapdragon 8 Gen 3\n- SU7 Ultra EV (pre-sale at 814,900 yuan)\n- MIX Fold4 (226g, 4.59mm thickness) and MIX Flip\n\n✅ **Global Expansion**:\n- 27% global market share (record high)\n- Localization strategies driving international growth\n- 70+ million phones shipped globally in 2015 (historical context)\n\nThis represents Xiaomi's strongest annual performance to date, with sustained growth across products, markets, and revenue streams.\n\n\n",
+ "reasoning_content": "Okay, let's see. The user asked to analyze Xiaomi Corporation. I've been provided with four tool responses from web searches covering financial performance, market share, recent products, and global expansion strategy. Let me check if all these pieces are sufficient to form a comprehensive analysis.\n\nFirst, the financial data: total revenue 365.9 billion RMB in 2024, smartphone revenue 191.8 billion, 169 million units sold. That's solid for financials. Then market share in China: 15.8% in Q4 2024, 18.8% in Q1 2025, which shows growth. Recent products include the 15 series, SU7 Ultra, and foldables. Global strategy mentions 27% market share and localization efforts.\n\nWait, the user's question is to \"analyze Xiaomi Corporation.\" The provided data covers key areas: financials, market share, product launches, and expansion. Each of the four search results addresses a different aspect. The user probably needs a summary that ties these together. Since all necessary data is here, there's no need for more web searches. The next step is to compile this into a coherent answer.\n\nI should check if there's anything missing. For example, maybe competition details or future projections, but the user didn't ask for that. The given data seems sufficient for a basic analysis. The financials, market share, product updates, and global strategy are all covered. So the context is sufficient. Therefore, the terminate tool with status success should be used.",
"tool_calls": [],
"tool_call_id": "",
+ "time_created": "2025-08-29 01:42:51",
"metadata": {}
},
{
"role": "user",
- "content": "Please integrate the context and provide a complete answer to the user's question.\nPlease determine the response language based on the language of the user's question.\n\n# User's Question\n{query}\n",
+ "content": "Please integrate the context and provide a complete answer to the user's question.\n\n# User's Question\n{query}\n",
"reasoning_content": "",
"tool_calls": [],
"tool_call_id": "",
+ "time_created": "2025-08-29 01:42:52",
"metadata": {}
},
{
"role": "assistant",
- "content": "### Analysis of Xiaomi Corporation\n\n#### Overview\nXiaomi Corporation, founded in April 2010, is a leading consumer electronics and smart manufacturing company listed on the Main Board of the Hong Kong Stock Exchange since July 9, 2018. The company focuses on smartphones, smart hardware connected via an IoT platform, and innovative consumer electronics solutions. Key technological advancements include adopting the OceanBase distributed database for smart manufacturing systems, which has improved performance by 2-3 times and reduced costs. Notable product innovations comprise the Xiaomi TV A Pro series with 4K QLED displays and Dolby Vision®, and the Xiaomi Mijia Constant Temperature Electric Kettle.\n\n#### Financial Performance\nIn 2024, Xiaomi reported its best-ever annual earnings:\n- **Total Revenue**: RMB 365.9 billion.\n- **Monthly Active Users**: 686 million globally for smartphones and tablets.\n- **Connected IoT Devices**: 904.6 million as of 2024.\n\nFor the first quarter of 2025, Xiaomi achieved significant financial milestones:\n- **Revenue**: ¥111.3 billion (up 47.4% YoY).\n- **Adjusted Net Profit**: ¥10.7 billion (record high, up 64.5% YoY).\n- **Smartphone Business Revenue**: ¥50.6 billion (up 8.9% YoY).\n- **IoT and Lifestyle Products Revenue**: ¥32.3 billion (up 58.7% YoY).\n- **EV and AI Innovation Business Revenue**: ¥18.6 billion.\n- **Xiaomi SU7 Series Deliveries**: 75,869 units in Q1 2025.\n\n#### Market Position\nXiaomi holds a competitive position in the global market:\n- Leading manufacturer in smartphones, smart hardware, and IoT platforms.\n- Emphasizes innovation, quality, and affordability to enhance user experience through technology.\n- Expansion into electric vehicles with notable achievements such as delivering 100,000 units within 229 days and doubling that number within 110 days.\n\n#### Recent News/Developments\n- Launched **Xiaomi Smart Doorbell 4 Pro** at a discounted price of ¥394.\n- Introduced **Xiaomi SU7 series**, achieving significant sales figures.\n- Upcoming launch of **Xiaomi SU7 Ultra** with advanced features like an 835 km range.\n- Released the **3nm flagship smartphone SoC chip Xiaomi Xuanji o1**, ranking among global leaders in performance.\n- Plans to invest ¥200 billion in R&D from 2025–2030, building on previous investments.\n\n#### Future Outlook\nXiaomi faces challenges such as market saturation and brand premiumization but aims to overcome these through strategic initiatives:\n- Increased focus on R&D and launching innovative products.\n- Adapting to trends in personalized and intelligent marketing.\n- Expanding offline presence with 16,000 Xiaomi Home stores and 235 EV sales outlets in Mainland China.\n\n### Conclusion\nXiaomi Corporation continues to innovate and expand its footprint across various markets. With solid financial performance, strategic investments in R&D, and a robust pipeline of new products, Xiaomi is well-positioned for future growth despite facing market challenges. \n\n---\n\nThis analysis provides a comprehensive overview of Xiaomi Corporation's current status and future prospects. If you have any specific areas you'd like more details on, feel free to ask!",
- "reasoning_content": "",
+ "content": "terminate\n{\n \"answer\": \"Xiaomi Corporation has delivered its strongest annual performance to date in 2024, with comprehensive growth across all key business dimensions:\\n\\n✅ **Financial Performance**\\n- Total Revenue: RMB 365.9 billion (2024)\\n- Smartphone Revenue: RMB 191.8 billion (52% of total sales)\\n- 169 million smartphones sold globally\\n- Q1 2025 Revenue: RMB 111.3 billion (+47.4% YoY)\\n- CEO Lei Jun described 2024 as \\\"the strongest annual report in history\\\"\\n\\n✅ **Market Dominance**\\n- China smartphone market share: 15.8% (Q4 2024), 18.8% (Q1 2025)\\n- 18.1% share in RMB 3,000-4,000 segment (Q3 2024)\\n- 4 consecutive quarters of market share growth in China\\n\\n✅ **Product Innovation**\\n- Xiaomi 15 Series (Oct 2024): Snapdragon 8 Gen 3, Leica optics, HyperOS 2\\n- SU7 Ultra EV: 1.98s 0-100km/h acceleration, 814,900 yuan pre-sale\\n- MIX Fold4: 226g, 4.59mm thickness, 500k+ fold tests\\n- Redmi K70 Ultra: Dimensity 9300+ processor, 2.38M+ benchmark\\n\\n✅ **Global Expansion**\\n- Achieved 27% global market share (record high)\\n- Localization strategies driving international growth\\n- 70+ million phones shipped globally (2015 historical context)\\n\\nXiaomi's 2024-2025 performance demonstrates successful execution of its product ecosystem strategy, market localization, and technological innovation across smartphones, EVs, and IoT devices.\"\n}",
+ "reasoning_content": "Okay, let's tackle this. The user asked to \"Analyze Xiaomi Corporation,\" and the assistant has already provided a detailed analysis based on the search results. Now, I need to make sure the answer is complete and integrates all the context provided.\n\nFirst, check if all the necessary information is covered. The previous response listed financials, market share, products, and global strategy. The search results included data from 2024 and Q1 2025, which seems up-to-date. The user's current time is 2025-08-29, so the Q1 2025 data is relevant.\n\nWait, the user's question is just \"Analyze Xiaomi Corporation,\" so the answer should summarize the key points without needing more data. The assistant's previous answer seems to have all the necessary info from the provided context. The tools used were web_search for each subtask, and the results were integrated into the analysis.\n\nI need to confirm if there's anything missing. The financials, market share, products, and global strategy are all covered. The mention of the CEO calling it the \"strongest annual report in history\" adds context. The product launches in 2024 (Xiaomi 15 Series, SU7 Ultra, MIX Fold4) are all included. Global expansion mentions 27% market share, which is a key point.\n\nNo additional tools are needed because all required data is present in the context. The assistant should terminate the process and provide the integrated answer. The previous \"terminate\" response was correct. The user's answer is already complete, so the correct action is to use the terminate tool with the answer.\n",
"tool_calls": [],
"tool_call_id": "",
+ "time_created": "2025-08-29 01:43:02",
"metadata": {}
}
]
\ No newline at end of file
diff --git a/cookbook/simple_demo/simple_demo.py b/cookbook/simple_demo/simple_demo.py
index a0b42375..1fa18d83 100644
--- a/cookbook/simple_demo/simple_demo.py
+++ b/cookbook/simple_demo/simple_demo.py
@@ -4,13 +4,12 @@ import requests
from dotenv import load_dotenv
load_dotenv()
-base_url = "http://0.0.0.0:8001/"
-workspace_id = "test_workspace1"
+base_url = "http://0.0.0.0:8002/"
+workspace_id = "test_workspace4"
def run_agent(query: str, dump_messages: bool = False):
-
- response = requests.post(url=base_url + "agent", json={"query": query})
+ response = requests.post(url=base_url + "react", json={"query": query})
if response.status_code != 200:
print(response.text)
return []
@@ -28,10 +27,10 @@ def run_agent(query: str, dump_messages: bool = False):
return messages
-def run_summary(messages: list, dump_experience: bool = True):
- response = requests.post(url=base_url + "summarizer", json={
+def run_summary(messages: list, enable_dump_memory: bool = True):
+ response = requests.post(url=base_url + "summary_task_memory_simple", json={
"workspace_id": workspace_id,
- "traj_list": [
+ "trajectories": [
{"messages": messages, "score": 1.0}
]
})
@@ -41,14 +40,14 @@ def run_summary(messages: list, dump_experience: bool = True):
return
response = response.json()
- experience_list = response["experience_list"]
- if dump_experience:
- with open("experience.jsonl", "w") as f:
- f.write(json.dumps(experience_list, indent=2, ensure_ascii=False))
+ memory_list = response["metadata"]["memory_list"]
+ if enable_dump_memory:
+ with open("memory.jsonl", "w") as f:
+ f.write(json.dumps(memory_list, indent=2, ensure_ascii=False))
-def run_retriever(query: str):
- response = requests.post(url=base_url + "retriever", json={
+def run_retrieve(query: str):
+ response = requests.post(url=base_url + "retrieve_task_memory_simple", json={
"workspace_id": workspace_id,
"query": query,
})
@@ -58,20 +57,20 @@ def run_retriever(query: str):
return ""
response = response.json()
- experience_merged: str = response["experience_merged"]
- print(f"experience_merged={experience_merged}")
- return experience_merged
+ answer: str = response["answer"]
+ print(f"answer={answer}")
+ return answer
-def run_agent_with_experience(query_first: str, query_second: str, dump_experience: bool = True):
+def run_agent_with_memory(query_first: str, query_second: str, enable_dump_memory: bool = True):
messages = run_agent(query=query_second)
- run_summary(messages, dump_experience)
- experience_merged = run_retriever(query_first)
- messages = run_agent(query=f"{experience_merged}\n\nUser Question:\n{query_first}")
+ run_summary(messages, enable_dump_memory)
+ retrieved_memory = run_retrieve(query_first)
+ messages = run_agent(query=f"{retrieved_memory}\n\nUser Question:\n{query_first}")
return messages
-def dump_experience():
+def dump_memory():
response = requests.post(url=base_url + "vector_store", json={
"workspace_id": workspace_id,
"action": "dump",
@@ -85,7 +84,7 @@ def dump_experience():
print(response.json())
-def load_experience():
+def load_memory():
response = requests.post(url=base_url + "vector_store", json={
"workspace_id": "test_workspace2",
"action": "load",
@@ -104,6 +103,6 @@ if __name__ == "__main__":
query2 = "Analyze the company Tesla."
run_agent(query=query1, dump_messages=True)
- run_agent_with_experience(query_first=query1, query_second=query2)
- dump_experience()
- load_experience()
+ run_agent_with_memory(query_first=query1, query_second=query2)
+ dump_memory()
+ load_memory()
diff --git a/reme_ai/__init__.py b/reme_ai/__init__.py
index 2d3bb9a9..c2b96554 100644
--- a/reme_ai/__init__.py
+++ b/reme_ai/__init__.py
@@ -1,3 +1,4 @@
+from reme_ai import react
from reme_ai import retrieve
from reme_ai import summary
from reme_ai import vector_store
diff --git a/reme_ai/config/default.yaml b/reme_ai/config/default.yaml
index 5b59b9ff..93f0af06 100644
--- a/reme_ai/config/default.yaml
+++ b/reme_ai/config/default.yaml
@@ -40,7 +40,7 @@ flow:
input_schema:
query:
type: "str"
- description: "user query"
+ description: "current query"
required: true
summary_task_memory_simple:
@@ -51,44 +51,10 @@ flow:
type: "list"
description: "A list of conversation trajectory information, including message content and score. This field does not need to be filled in, the system will complete it automatically."
required: false
-
- record_task_memory:
- flow_content: update_memory_freq_op >> update_memory_utility_op >> update_vector_store_op
- description: "Update the freq & utility attributes of retrieved task memories"
- input_schema:
- workspace_id:
- type: "str"
- description: "workspace id"
- required: true
- memory_dicts:
- type: "list"
- description: "A list of retrieved task memory corresponding to the current task."
- required: true
- update_utility:
- type: "bool"
- description: "Whether to update the utility attribute of the retrieved task memory."
- required: true
-
- delete_task_memory:
- flow_content: delete_memory_op >> update_vector_store_op
- description: "Delete task memories when utility/freq < utility_threshold and freq >= freq_threshold"
- input_schema:
- workspace_id:
- type: "str"
- description: "workspace id"
- required: true
- freq_threshold:
- type: "int"
- description: "The retrieved frequency threshold for deleting task memory."
- required: true
- utility_threshold:
- type: "float"
- description: "The utility/freq threshold for deleting task memory."
- required: true
vector_store:
flow_content: vector_store_action_op
- description: "directly operate the vector store."
+ description: "Directly operates on the vector store with various management actions"
input_schema:
action:
type: "str"
@@ -113,22 +79,11 @@ flow:
type: "list"
description: "A list of conversation messages information. This field does not need to be filled in, the system will complete it automatically."
required: false
-
-op:
- # retriever ops
- rerank_memory_op:
- backend: rerank_memory_op
- llm: default
- params:
- enable_llm_rerank: true
- enable_score_filter: false
- top_k: 5
- rewrite_memory_op:
- backend: rewrite_memory_op
- llm: default
- params:
- enable_llm_rewrite: true
+# reconsolidate_personal_memory:
+# flow_content: load_not_reflected_memory_op >> get_reflection_subject_op >> update_insight_op >> long_contra_repeat_op >> update_vector_store_op
+# description: "Consolidate personal memories by generating topic insights, updating values, resolving conflicts, and updating vector store"
+
llm:
default:
@@ -137,7 +92,6 @@ llm:
model_name: qwen3-30b-a3b-instruct-2507
params:
temperature: 0.6
-
embedding_model:
default:
diff --git a/reme_ai/react/__init__.py b/reme_ai/react/__init__.py
new file mode 100644
index 00000000..023c0a6d
--- /dev/null
+++ b/reme_ai/react/__init__.py
@@ -0,0 +1 @@
+from .simple_react_op import SimpleReactOp
\ No newline at end of file
diff --git a/reme_ai/react/simple_react_op.py b/reme_ai/react/simple_react_op.py
new file mode 100644
index 00000000..db165cd5
--- /dev/null
+++ b/reme_ai/react/simple_react_op.py
@@ -0,0 +1,21 @@
+from flowllm import C
+from flowllm.context.flow_context import FlowContext
+from flowllm.op.agent.react_op import ReactOp
+
+
+@C.register_op()
+class SimpleReactOp(ReactOp):
+ ...
+
+
+if __name__ == "__main__":
+ from reme_ai.config.config_parser import ConfigParser
+
+ C.set_default_service_config(parser=ConfigParser).init_by_service_config()
+ context = FlowContext(query="茅台和五粮现在股价多少?")
+
+ op = SimpleReactOp()
+ op(context=context)
+ # from reme_ai.schema import Message
+ # result = op.llm.chat(messages=[Message(**{"role": "user", "content": "你叫什么名字?"})])
+ # print("!!!", result)
\ No newline at end of file
diff --git a/reme_ai/summary/personal/contra_repeat_op.py b/reme_ai/summary/personal/contra_repeat_op.py
index 68ecfbab..f4643a0f 100644
--- a/reme_ai/summary/personal/contra_repeat_op.py
+++ b/reme_ai/summary/personal/contra_repeat_op.py
@@ -130,7 +130,7 @@ class ContraRepeatOp(BaseLLMOp):
judgment_lower = judgment.lower()
if judgment_lower in ['矛盾', 'contradiction', '被包含', 'contained']:
indices_to_remove.add(idx)
- deleted_memory_ids.append(memories[idx].id)
+ deleted_memory_ids.append(memories[idx].memory_id)
logger.info(f"Marking memory {idx + 1} for removal: {judgment} - {memories[idx].content[:100]}...")
except ValueError:
diff --git a/reme_ai/summary/personal/get_observation_op.py b/reme_ai/summary/personal/get_observation_op.py
index 662011a8..d126e41c 100644
--- a/reme_ai/summary/personal/get_observation_op.py
+++ b/reme_ai/summary/personal/get_observation_op.py
@@ -96,7 +96,8 @@ class GetObservationOp(BaseLLMOp):
# Create observation memory
observation = PersonalMemory(
- workspace_id=self.context.get("workspace_id", ""),
+ workspace_id=self.context.workspace_id,
+ when_to_use=obs["keywords"],
content=obs["content"],
target=user_name,
author=self.llm.model_name,
diff --git a/reme_ai/summary/personal/get_observation_with_time_op.py b/reme_ai/summary/personal/get_observation_with_time_op.py
index 27c7f615..0b474db2 100644
--- a/reme_ai/summary/personal/get_observation_with_time_op.py
+++ b/reme_ai/summary/personal/get_observation_with_time_op.py
@@ -105,7 +105,8 @@ class GetObservationWithTimeOp(BaseLLMOp):
# Create observation memory
observation = PersonalMemory(
- workspace_id=self.context.get("workspace_id", ""),
+ workspace_id=self.context.workspace_id,
+ when_to_use=obs["keywords"],
content=obs["content"],
target=user_name,
author=getattr(self.llm, "model_name", "system"),
diff --git a/reme_ai/utils/datetime_handler.py b/reme_ai/utils/datetime_handler.py
index 5a7f61b4..7feafa7d 100644
--- a/reme_ai/utils/datetime_handler.py
+++ b/reme_ai/utils/datetime_handler.py
@@ -29,7 +29,11 @@ class DatetimeHandler(object):
"""
if isinstance(dt, str | int | float):
if isinstance(dt, str):
- dt = float(dt)
+ try:
+ dt = float(dt)
+ except:
+ dt = datetime.datetime.strptime(dt, "%Y-%m-%d %H:%M:%S")
+ dt = dt.timestamp()
self._dt: datetime.datetime = datetime.datetime.fromtimestamp(dt)
elif isinstance(dt, datetime.datetime):
self._dt: datetime.datetime = dt
diff --git a/reme_ai/vector_store/recall_vector_store_op.py b/reme_ai/vector_store/recall_vector_store_op.py
index d0e89e0b..bb375bde 100644
--- a/reme_ai/vector_store/recall_vector_store_op.py
+++ b/reme_ai/vector_store/recall_vector_store_op.py
@@ -19,7 +19,6 @@ class RecallVectorStoreOp(BaseLLMOp):
workspace_id: str = self.context.workspace_id
nodes: List[VectorNode] = self.vector_store.search(query=query, workspace_id=workspace_id, top_k=top_k)
-
memory_list: List[BaseMemory] = []
memory_content_list: List[str] = []
for node in nodes:
diff --git a/test/http_client_test.py b/test/http_client_test.py
index f95167d2..0e276ff3 100644
--- a/test/http_client_test.py
+++ b/test/http_client_test.py
@@ -78,7 +78,13 @@ async def run2(session):
result = await response.json()
print(json.dumps(result, ensure_ascii=False))
- messages = [{"role": "user", "content": "我喜欢吃西瓜🍉"}]
+ messages = [
+ {"role": "user", "content": "我喜欢吃西瓜🍉"},
+ {"role": "user", "content": "昨天吃了苹果,很好吃"},
+ {"role": "user", "content": "我不太喜欢吃西瓜"},
+ {"role": "user", "content": "上周我去了日本,得了肠胃炎"},
+ {"role": "user", "content": "这周只能在家里,喝粥"},
+ ]
async with session.post(
f"{base_url}/summary_personal_memory",
@@ -96,7 +102,7 @@ async def run2(session):
async with session.post(
f"{base_url}/retrieve_personal_memory",
json={
- "query": "茅台怎么样?",
+ "query": "你知道我喜欢吃什么?",
"workspace_id": workspace_id,
},
headers={"Content-Type": "application/json"}