@stephen-lord/other2 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/manus/CN-/346/211/222/345/256/214/345/205/250/347/275/221/346/234/200/345/274/272-AI-/345/233/242/351/230/237/347/232/204-Context-Engineering-/346/224/273/347/225/245/346/210/221/344/273/254/346/200/273/347/273/223/345/207/272/344/272/206/350/277/231-5-/345/244/247/346/226/271/346/263/225-/346/231/272/346/272/220/347/244/276/345/214/272.md +2464 -0
- package/dist/docs/manus/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus.md +212 -0
- package/dist/docs/manus/Context-Engineering-for-AI-Agents-Part-2.md +96 -0
- package/dist/docs/manus/Industry.md +94 -0
- package/dist/docs/manus/Observability-for-Manus-15-Agents-Logs-Retries-and-Error-Budgets.md +346 -0
- package/dist/docs/manus/OpenManus-Technical-Analysis-Architecture-and-Implementation-of-an-Open-Source-A.md +324 -0
- package/dist/docs/manus/README.md +85 -0
- package/dist/docs/manus/Tech-Constrained-Decoding-Agent-Reliability.md +81 -0
- package/dist/docs/manus/Tech-How-to-build-function-calling-and-JSON-mode.md +43 -0
- package/dist/docs/manus/Tech-Understanding-Logit-Bias-in-LLMs-Medium.md +1354 -0
- package/dist/docs/manus/The-Performance-Reality-KV-Cache-as-the-North-Star.md +155 -0
- package/dist/docs/manus/Why-Context-Engineering.md +125 -0
- package/dist/docs/manus/article_1_raw.md +1 -0
- package/dist/docs/manus/split_articles.py +52 -0
- package/dist/docs/manus//346/235/245/350/207/252-Manus-/347/232/204/344/270/200/346/211/213/345/210/206/344/272/253/345/246/202/344/275/225/346/236/204/345/273/272-AI-Agent-/347/232/204/344/270/212/344/270/213/346/226/207/345/267/245/347/250/213-/346/231/272/346/272/220/347/244/276/345/214/272.md +2180 -0
- package/dist/ui-ux-pro-max/SKILL.md +386 -0
- package/dist/ui-ux-pro-max/data/charts.csv +26 -0
- package/dist/ui-ux-pro-max/data/colors.csv +97 -0
- package/dist/ui-ux-pro-max/data/icons.csv +101 -0
- package/dist/ui-ux-pro-max/data/landing.csv +31 -0
- package/dist/ui-ux-pro-max/data/products.csv +97 -0
- package/dist/ui-ux-pro-max/data/prompts.csv +24 -0
- package/dist/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/dist/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/dist/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/dist/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/dist/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/dist/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/dist/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/dist/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/dist/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/dist/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/dist/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/dist/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/dist/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/dist/ui-ux-pro-max/data/styles.csv +59 -0
- package/dist/ui-ux-pro-max/data/typography.csv +58 -0
- package/dist/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/dist/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/dist/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/dist/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
- package/dist/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/dist/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/dist/ui-ux-pro-max/scripts/core.py +258 -0
- package/dist/ui-ux-pro-max/scripts/design_system.py +1066 -0
- package/dist/ui-ux-pro-max/scripts/search.py +106 -0
- package/package.json +6 -6
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Manus Context Engineering 文档索引
|
|
2
|
+
|
|
3
|
+
本目录包含了关于 Manus Context Engineering 和 Logit Masking 技术的文章文档。
|
|
4
|
+
|
|
5
|
+
## 核心文章(官方原文)
|
|
6
|
+
|
|
7
|
+
### 英文原文
|
|
8
|
+
- **Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus.md** - Peak Ji 的官方原文,Manus 的 Context Engineering 核心经验
|
|
9
|
+
- **Why-Context-Engineering.md** - Lance Martin 的分析文章
|
|
10
|
+
- **The-Performance-Reality-KV-Cache-as-the-North-Star.md** - KV Cache 性能优化详解
|
|
11
|
+
- **Context-Engineering-for-AI-Agents-Part-2.md** - Phil Schmid 的第二部分深度解析
|
|
12
|
+
|
|
13
|
+
### 中文翻译与解读
|
|
14
|
+
- **AI代理的上下文工程:构建Manus的经验教训.md** - 官方中文版(需单独保存)
|
|
15
|
+
- **来自-Manus-的一手分享如何构建-AI-Agent-的上下文工程-智源社区.md** - 智源社区翻译版本
|
|
16
|
+
- **CN-扒完全网最强-AI-团队的-Context-Engineering-攻略我们总结出了这-5-大方法-智源社区.md** - 智源社区总结的5大方法
|
|
17
|
+
- **Manus-内部的-Context-工程经验精校高亮要点-人人都是产品经理.md** - 精校翻译版本,带要点高亮
|
|
18
|
+
|
|
19
|
+
## 技术深度文章
|
|
20
|
+
|
|
21
|
+
### Logit Masking / Constrained Decoding
|
|
22
|
+
- **Tech-Understanding-Logit-Bias-in-LLMs-Medium.md** - Logit Bias 技术详解
|
|
23
|
+
- **Tech-How-to-build-function-calling-and-JSON-mode-for-open-source-and-fine-tuned-LLMs.md** - 使用 State Machine 和 Logit Biasing 实现函数调用
|
|
24
|
+
- **Tech-Constrained-Decoding-and-Structured-Output-for-Agent-Reliability-Engineering-Notes.md** - 约束解码与结构化输出详解
|
|
25
|
+
|
|
26
|
+
### 架构与实践
|
|
27
|
+
- **Observability-for-Manus-15-Agents-Logs-Retries-and-Error-Budgets.md** - Manus 1.5 可观测性最佳实践
|
|
28
|
+
- **OpenManus-Technical-Analysis-Architecture-and-Implementation-of-an-Open-Source-A.md** - OpenManus 开源实现分析
|
|
29
|
+
- **Industry.md** - ZenML 的 Context Engineering 策略分析
|
|
30
|
+
|
|
31
|
+
## 中文深度解读
|
|
32
|
+
|
|
33
|
+
- **【深度专题】Context-Engineering-是什么-为什么-Manus-团队花千万美金踩坑-只为搞懂-怎么喂模型-.md** - 台湾 AI Post Hub 的深度专题解析
|
|
34
|
+
- **大白话读懂Manus-上下文优化策略-开发者社区-火山引擎.md** - 用大白话解释优化策略
|
|
35
|
+
|
|
36
|
+
## 建议阅读顺序
|
|
37
|
+
|
|
38
|
+
### 初学者路径
|
|
39
|
+
1. 先看 **智源社区的总结文章**(CN-扒完全网最强...)建立概念地图
|
|
40
|
+
2. 再看 **官方中文版** 或 **人人都是产品经理的精校版** 理解细节
|
|
41
|
+
3. 最后看 **官方英文原文** 理解原始表达
|
|
42
|
+
|
|
43
|
+
### 技术深入路径
|
|
44
|
+
1. **Context Engineering 核心原则**(官方原文)
|
|
45
|
+
2. **Logit Bias 技术详解**(Tech-Understanding-Logit-Bias)
|
|
46
|
+
3. **Constrained Decoding 实战**(Tech-Constrained-Decoding)
|
|
47
|
+
4. **Function Calling 实现**(Tech-How-to-build-function-calling)
|
|
48
|
+
|
|
49
|
+
## 核心技术要点总结
|
|
50
|
+
|
|
51
|
+
### 1. KV-Cache 命中率优化
|
|
52
|
+
- 保持提示前缀稳定
|
|
53
|
+
- 只追加,不修改历史
|
|
54
|
+
- 确定性序列化
|
|
55
|
+
|
|
56
|
+
### 2. Logit Masking 工具可见性
|
|
57
|
+
- 保留所有工具定义
|
|
58
|
+
- 通过 token logits 遮蔽实现动态控制
|
|
59
|
+
- 使用响应预填充技术
|
|
60
|
+
|
|
61
|
+
### 3. 文件系统作为外部记忆
|
|
62
|
+
- 上下文窗口有限
|
|
63
|
+
- 可逆压缩策略
|
|
64
|
+
- URL/路径作为恢复锚点
|
|
65
|
+
|
|
66
|
+
### 4. 错误保留与学习
|
|
67
|
+
- 保留失败记录
|
|
68
|
+
- 让模型从错误中学习
|
|
69
|
+
- 错误恢复是智能体标志
|
|
70
|
+
|
|
71
|
+
### 5. 避免少样本陷阱
|
|
72
|
+
- 增加上下文多样性
|
|
73
|
+
- 打破模式固化
|
|
74
|
+
- 防止机械模仿
|
|
75
|
+
|
|
76
|
+
## 关键概念
|
|
77
|
+
|
|
78
|
+
- **Context Engineering**: 上下文工程,通过设计输入上下文来塑造 AI Agent 行为
|
|
79
|
+
- **KV-Cache**: Key-Value 缓存,用于缓存已计算过的 token 表示
|
|
80
|
+
- **Logit Masking**: Logit 遮蔽,通过修改 token 概率分布来控制输出
|
|
81
|
+
- **Constrained Decoding**: 约束解码,限制模型只能生成符合特定格式的输出
|
|
82
|
+
- **State Machine**: 状态机,用于跟踪当前允许的有效 token 集合
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
*最后更新: 2026-03-28*
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Constrained Decoding and Structured Output for Agent Reliability
|
|
2
|
+
|
|
3
|
+
**Source:** https://notes.muthu.co/2025/11/constrained-decoding-and-structured-output-for-agent-reliability/
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
When building production AI agents, one of the most persistent problems is unpredictable output formats. An agent needs to call a tool with precise JSON parameters, but the LLM wraps the output in markdown code blocks, adds explanatory text, or hallucinate invalid field names.
|
|
8
|
+
|
|
9
|
+
## Concept Introduction
|
|
10
|
+
|
|
11
|
+
Constrained decoding modifies the token sampling process by masking invalid tokens, setting their probability to zero before sampling.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Standard Decoding:
|
|
15
|
+
P(next_token | context) → Sample from all vocabulary
|
|
16
|
+
|
|
17
|
+
Constrained Decoding:
|
|
18
|
+
P(next_token | context, grammar) → Sample only from valid tokens
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Types of Constraints
|
|
22
|
+
|
|
23
|
+
- A JSON schema (only generate valid JSON matching the schema)
|
|
24
|
+
- A regular expression (output must match the regex)
|
|
25
|
+
- A context-free grammar (follow specific syntax rules)
|
|
26
|
+
- A finite-state machine (transition through defined states)
|
|
27
|
+
|
|
28
|
+
### Modern Implementation Techniques
|
|
29
|
+
|
|
30
|
+
- Token masking at inference time
|
|
31
|
+
- Incremental parsing to track valid next tokens
|
|
32
|
+
- Beam search with grammar-aware scoring
|
|
33
|
+
- Logit bias to steer generation probabilistically
|
|
34
|
+
|
|
35
|
+
## Core Algorithm: FSM-Guided Token Masking
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
def constrained_decode(prompt, schema, max_tokens):
|
|
39
|
+
# Convert schema to FSM
|
|
40
|
+
fsm = schema_to_fsm(schema)
|
|
41
|
+
state = fsm.initial_state
|
|
42
|
+
tokens = []
|
|
43
|
+
|
|
44
|
+
for _ in range(max_tokens):
|
|
45
|
+
# Get next token logits from LLM
|
|
46
|
+
logits = llm.forward(prompt + tokens)
|
|
47
|
+
|
|
48
|
+
# Mask invalid tokens based on current FSM state
|
|
49
|
+
valid_tokens = fsm.get_valid_tokens(state)
|
|
50
|
+
masked_logits = mask_logits(logits, valid_tokens)
|
|
51
|
+
|
|
52
|
+
# Sample next token
|
|
53
|
+
next_token = sample(masked_logits)
|
|
54
|
+
tokens.append(next_token)
|
|
55
|
+
|
|
56
|
+
# Update FSM state
|
|
57
|
+
state = fsm.transition(state, next_token)
|
|
58
|
+
|
|
59
|
+
# Check if reached accept state
|
|
60
|
+
if fsm.is_terminal(state):
|
|
61
|
+
break
|
|
62
|
+
|
|
63
|
+
return tokens
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Key Libraries
|
|
67
|
+
|
|
68
|
+
- **Outlines** - Fast regex and JSON schema constraints using FSMs
|
|
69
|
+
- **Guidance** - Microsoft's grammar-based generation library
|
|
70
|
+
- **LM Format Enforcer** - Token masking for various formats
|
|
71
|
+
|
|
72
|
+
## Benchmarks (2024)
|
|
73
|
+
|
|
74
|
+
- **Prompt engineering**: 82% JSON valid
|
|
75
|
+
- **Post-processing**: 89% JSON valid
|
|
76
|
+
- **Constrained decoding**: 99.8% JSON valid
|
|
77
|
+
|
|
78
|
+
Tool Calling Reliability:
|
|
79
|
+
- **Standard generation**: 76% executable calls
|
|
80
|
+
- **OpenAI function calling**: 94% executable
|
|
81
|
+
- **Outlines JSON mode**: 99.2% executable
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# How to build function calling and JSON mode for open-source and fine-tuned LLMs
|
|
2
|
+
|
|
3
|
+
**Source:** https://baseten.co/blog/how-to-build-function-calling-and-json-mode-for-open-source-and-fine-tuned-llms
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Use a state machine to generate token masks for logit biasing to enable function calling and structured output at the model server level.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Today, we announced support for function calling and structured output for LLMs deployed with our TensorRT-LLM Engine Builder. This adds support at the model server level for two key features:
|
|
12
|
+
|
|
13
|
+
- **Function calling**: also known as "tool use," this feature lets you pass a set of defined tools to a LLM as part of the request body. Based on the prompt, the model selects and returns the most appropriate function/tool from the provided options.
|
|
14
|
+
|
|
15
|
+
- **Structured output**: an evolution of "JSON mode," this feature enforces an output schema defined as part of the LLM input. The LLM output is guaranteed to adhere to the provided schema, with full Pydantic support.
|
|
16
|
+
|
|
17
|
+
## How structured output is generated
|
|
18
|
+
|
|
19
|
+
To understand how it's possible to guarantee structured output, we need to dive into the details of how a token is generated during LLM inference:
|
|
20
|
+
|
|
21
|
+
1. A vector of logits is outputted from the final layer of the LLM's neural network
|
|
22
|
+
2. A normalization function like softmax is applied to turn the logits into probabilities
|
|
23
|
+
3. Using these probabilities, a token is selected
|
|
24
|
+
|
|
25
|
+
### Logit biasing ensures token validity
|
|
26
|
+
|
|
27
|
+
The length of the logit vector is equal to the number of tokens in the model's vocabulary. For example, Llama 3 LLMs have a vocabulary of ~128,000 tokens.
|
|
28
|
+
|
|
29
|
+
For structured output, we only want to generate valid tokens. Logit biasing guarantees valid output structure by identifying every invalid token and setting its score to negative infinity.
|
|
30
|
+
|
|
31
|
+
### State machine provides token requirements
|
|
32
|
+
|
|
33
|
+
The model server tracks output format using a state machine. Using the Outlines library:
|
|
34
|
+
|
|
35
|
+
1. Takes the schema passed as model output
|
|
36
|
+
2. Transforms it into a regular expression
|
|
37
|
+
3. Generates a state machine from that regex
|
|
38
|
+
|
|
39
|
+
The state machine is cached in memory, and an appropriate token mask is created for each node. This means calculations aren't made during inference time - existing masks are applied based on which state is active.
|
|
40
|
+
|
|
41
|
+
## Key Takeaway
|
|
42
|
+
|
|
43
|
+
Thanks to pre-computed token masks, there's minimal latency impact from using constrained decoding. You can expect the same tokens per second when generating JSON as when generating ordinary text.
|