Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/WenyuChiou/awesome-agentic-ai-zh
/ functions
Functions
391 in github.com/WenyuChiou/awesome-agentic-ai-zh
⨍
Functions
391
◇
Types & classes
12
↳
Endpoints
4
↓ 11 callers
Function
make_resp
(finish_reason: str, content: str = "", tool_calls=None)
examples/stage-3/04-multi-step-reasoning/test.py:35
↓ 10 callers
Function
block_text
(text: str)
examples/stage-3/04-multi-step-reasoning/test_anthropic.py:22
↓ 10 callers
Function
make_resp
(stop_reason: str, *blocks)
examples/stage-3/04-multi-step-reasoning/test_anthropic.py:30
↓ 9 callers
Function
make_tool_call
(call_id: str, name: str, args: dict)
examples/stage-3/04-multi-step-reasoning/test.py:27
↓ 8 callers
Function
block_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/04-multi-step-reasoning/test_anthropic.py:26
↓ 8 callers
Function
make_resp
(finish_reason: str, content: str = "", tool_calls=None)
examples/stage-3/05-error-handling/test.py:36
↓ 7 callers
Function
_looks_like_switcher
True if a single line is a switcher-ish line in ANY form — canonical, old/reordered, no-`./`-prefix, bare (no `> `), or a known stub. This is
scripts/sync-language-switchers.py:180
↓ 7 callers
Function
block_text
(s: str)
examples/stage-3/03-react-from-scratch/test_anthropic.py:29
↓ 7 callers
Function
make_resp
Build a fake OpenAI chat.completions response.
examples/stage-3/03-react-from-scratch/test.py:40
↓ 7 callers
Function
make_resp
(stop_reason: str, *blocks)
examples/stage-3/03-react-from-scratch/test_anthropic.py:37
↓ 7 callers
Function
run
跑一輪含 HITL 的 workflow。`approve` 模擬人類審核決定。
examples/stage-4/03-graph-workflow/starter.py:105
↓ 7 callers
Function
semantic_query
Semantic search.
examples/stage-6/02-vector-db/starter.py:71
↓ 7 callers
Function
with_retry
Exponential backoff retry。 - RETRIABLE 例外 → 等 base * 2^attempt 秒再試(含 jitter) - 不 retriable 例外(譬如 AuthenticationError)→ 直接 raise、不浪費時間
examples/stage-1/05-error-handling/starter_anthropic.py:45
↓ 7 callers
Function
with_retry
Exponential backoff retry。 - RETRIABLE 例外 → 等 base * 2^attempt 秒再試(含 jitter) - 不 retriable 例外(譬如 AuthenticationError)→ 直接 raise、不浪費時間
examples/stage-1/05-error-handling/starter.py:55
↓ 6 callers
Function
block_text
(text: str)
examples/stage-3/05-error-handling/test_anthropic.py:22
↓ 6 callers
Function
build_collection
建立 / 取回 chroma collection。path=':memory:' 表 in-memory。
examples/stage-6/02-vector-db/starter.py:39
↓ 6 callers
Function
index_docs
Bulk add docs to collection.
examples/stage-6/02-vector-db/starter.py:54
↓ 6 callers
Function
make_chunk
(delta)
examples/stage-7/04-sdk-advanced/test.py:17
↓ 6 callers
Function
make_resp
(stop_reason: str, *blocks)
examples/stage-3/05-error-handling/test_anthropic.py:30
↓ 6 callers
Method
remember
Add a fact to memory. Returns the memory id.
examples/stage-6/05-long-term-memory/starter.py:48
↓ 5 callers
Function
block_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/03-react-from-scratch/test_anthropic.py:33
↓ 5 callers
Function
fresh_memory
每個 test 用獨立 collection 避免 EphemeralClient 跨 test 共享 state。
examples/stage-6/05-long-term-memory/test.py:17
↓ 5 callers
Function
make_tool_call
(call_id: str, name: str, args: dict)
examples/stage-3/05-error-handling/test.py:28
↓ 5 callers
Function
make_tool_call
(call_id: str, name: str, args: dict)
examples/stage-3/03-react-from-scratch/test.py:32
↓ 5 callers
Function
maybe_remember_fact
Heuristic: if user says 'I am / I like / I live', store as a fact.
examples/stage-6/05-long-term-memory/starter.py:93
↓ 5 callers
Function
run_tool_selection
單輪 call:LLM 看完 question + tools 後選一個 tool 呼叫,本地執行 observation 接回去。
examples/stage-3/02-multi-tool-selection/starter.py:89
↓ 5 callers
Function
set_weather_failures
(plan: list[bool])
examples/stage-3/05-error-handling/starter.py:39
↓ 5 callers
Function
trace_span
Context manager 計時 + 記 span。
examples/stage-7/03-observability/starter.py:79
↓ 5 callers
Function
update_file
更新單一檔案的 switcher。回傳 True 表示有改動需要寫入。
scripts/sync-language-switchers.py:219
↓ 4 callers
Function
_rel
repo-relative path for logging; falls back to the name for temp/selftest files.
scripts/sync-language-switchers.py:164
↓ 4 callers
Function
block_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/05-error-handling/test_anthropic.py:26
↓ 4 callers
Function
calculator
Safe arithmetic calculator (whitelist + - * / parentheses). Args: expression: Arithmetic expression to evaluate, e.g. '2 + 3 * (4 - 1)'.
examples/stage-4/04-codeact-vs-json-tool/starter.py:41
↓ 4 callers
Function
find_nearest
Returns top-k nearest sentences with cosine similarity scores.
examples/stage-6/01-embeddings/starter.py:49
↓ 4 callers
Function
hex_to_rgb
(h: str)
scripts/generate-stage5-stack.py:82
↓ 4 callers
Function
llm_call
(system: str, user: str, llm: Any = None)
examples/stage-7/01-multi-agent-debate/starter.py:29
↓ 4 callers
Function
make_inline_switcher
一般檔 blockquote 一行 switcher。
scripts/sync-language-switchers.py:104
↓ 4 callers
Function
rag
Full RAG pipeline.
examples/stage-6/04-full-rag-pipeline/starter.py:99
↓ 4 callers
Function
react_loop
OpenAI-compat 多步驟 ReAct loop。
examples/stage-3/04-multi-step-reasoning/starter.py:119
↓ 4 callers
Function
react_loop
OpenAI-compat ReAct loop。tool error 是結構化 JSON、放進 tool_result 給 LLM 看。
examples/stage-3/05-error-handling/starter.py:68
↓ 4 callers
Function
react_loop
純 while 迴圈、每輪: 1. 問 LLM(含 tools) 2. 看 stop_reason:tool_use → 執行工具、把結果加進 messages、繼續 end_turn → 完成、回傳最終答案 回
examples/stage-3/03-react-from-scratch/starter_anthropic.py:87
↓ 4 callers
Function
react_loop
OpenAI-compatible ReAct loop。每輪: 1. 問 LLM(含 tools) 2. finish_reason: 'tool_calls' → 執行 tool、observation 接回、繼續
examples/stage-3/03-react-from-scratch/starter.py:98
↓ 4 callers
Method
recall
Retrieve top-k relevant memories.
examples/stage-6/05-long-term-memory/starter.py:54
↓ 4 callers
Function
run
Public entrypoint: 跑一輪 agent、回傳 final message + steps。
examples/stage-4/01-same-agent-two-frameworks/starter.py:82
↓ 4 callers
Function
run_tool_selection
(question: str, client: Any = None)
examples/stage-3/02-multi-tool-selection/starter_anthropic.py:65
↓ 4 callers
Function
set_weather_failures
(plan: list[bool])
examples/stage-3/05-error-handling/starter_anthropic.py:32
↓ 4 callers
Function
tool_calculator
安全的計算器:只允許 + - * / 跟數字。
examples/stage-3/03-react-from-scratch/starter_anthropic.py:33
↓ 4 callers
Function
tool_calculator
安全的計算器:只允許 + - * / 跟數字。
examples/stage-3/03-react-from-scratch/starter.py:37
↓ 3 callers
Function
_make_connection_error
openai.APIConnectionError 需要 request 參數、用 MagicMock 假裝。
examples/stage-1/05-error-handling/test.py:30
↓ 3 callers
Function
_make_connection_error
anthropic.APIConnectionError 需要 request 參數、用 MagicMock 假裝。
examples/stage-1/05-error-handling/test_anthropic.py:29
↓ 3 callers
Function
_wrap
(name: str, description: str, field: str, field_description: str)
examples/stage-3/02-multi-tool-selection/starter.py:59
↓ 3 callers
Method
add_tokens
(self, input_t: int, output_t: int)
examples/stage-7/03-observability/starter.py:58
↓ 3 callers
Function
build_kb
(doc: str)
examples/stage-6/04-full-rag-pipeline/starter.py:63
↓ 3 callers
Function
cached_query
示範 prompt caching:第一次 call 沒 cache、第二次 hit cache、看 usage 差異。
examples/stage-7/04-sdk-advanced/starter_anthropic.py:40
↓ 3 callers
Function
chat
One conversation turn with memory recall + storage.
examples/stage-6/05-long-term-memory/starter.py:69
↓ 3 callers
Function
chunk_fixed
固定長度切(with overlap)。簡單但會切壞句子 / 段落。
examples/stage-6/03-chunking-comparison/starter.py:55
↓ 3 callers
Function
chunk_headings
Heading-aware:按 # / ## 切、每個 section 含 heading + body、有 hierarchy 標記。
examples/stage-6/03-chunking-comparison/starter.py:70
↓ 3 callers
Function
chunk_paragraphs
按段落切(雙 newline 為界)。保語意完整、但段落長短不一。
examples/stage-6/03-chunking-comparison/starter.py:65
↓ 3 callers
Function
classify_node
看 query 決定要不要 search。簡化邏輯:含關鍵字「人口 / 天氣 / 最新」就 search。
examples/stage-4/03-graph-workflow/starter.py:48
↓ 3 callers
Function
compare
(prompt: str)
examples/stage-1/04-cross-provider/starter.py:108
↓ 3 callers
Function
debate
3-agent debate:pro / con / judge。
examples/stage-7/01-multi-agent-debate/starter.py:38
↓ 3 callers
Function
divide
(a: float, b: float)
examples/stage-3/04-multi-step-reasoning/starter_anthropic.py:34
↓ 3 callers
Function
divide
(a: float, b: float)
examples/stage-3/04-multi-step-reasoning/starter.py:44
↓ 3 callers
Function
embed_openai
Encode via OpenAI embeddings API.
examples/stage-6/01-embeddings/starter_anthropic.py:29
↓ 3 callers
Function
eval_substring
(output: str, case: dict)
examples/stage-7/02-eval/starter.py:58
↓ 3 callers
Function
fetch_weather
(city: str)
examples/stage-3/05-error-handling/starter_anthropic.py:37
↓ 3 callers
Function
fetch_weather
假的 weather API、用 _failure_plan 決定這次該失敗還是成功。
examples/stage-3/05-error-handling/starter.py:44
↓ 3 callers
Function
fmt_stars
(n: int)
scripts/refresh-stars.py:105
↓ 3 callers
Function
llm_call_anthropic
(system: str, user: str, client: Any = None)
examples/stage-7/01-multi-agent-debate/starter_anthropic.py:25
↓ 3 callers
Function
make_fake_model
Mock SentenceTransformer:給定 text → vec 對應表。
examples/stage-6/01-embeddings/test.py:25
↓ 3 callers
Function
make_llm
(responses: list[str])
examples/stage-7/01-multi-agent-debate/test.py:15
↓ 3 callers
Function
make_mock_llm
(answer: str = "Mock answer.")
examples/stage-6/04-full-rag-pipeline/test.py:16
↓ 3 callers
Function
mock_client_for
(name: str, args: dict)
examples/stage-3/02-multi-tool-selection/test.py:42
↓ 3 callers
Function
mock_client_for
(name: str, inp: dict)
examples/stage-3/02-multi-tool-selection/test_anthropic.py:34
↓ 3 callers
Function
react_loop
(question: str, max_iter: int = 8, client: Any = None)
examples/stage-3/04-multi-step-reasoning/starter_anthropic.py:62
↓ 3 callers
Function
react_loop
(question: str, max_iter: int = 5, client: Any = None)
examples/stage-3/05-error-handling/starter_anthropic.py:57
↓ 3 callers
Function
retrieve
(collection: Any, query: str, top_k: int = 2)
examples/stage-6/04-full-rag-pipeline/starter.py:75
↓ 3 callers
Function
run_eval
(cases: list[dict], agent_fn: Callable, eval_fn: Callable, **agent_kwargs)
examples/stage-7/02-eval/starter.py:82
↓ 3 callers
Function
set_gh_output
Set a GitHub Actions output variable.
scripts/check-mirror-sync.py:128
↓ 3 callers
Function
stream_response
Yield each token chunk as it arrives.
examples/stage-7/04-sdk-advanced/starter.py:30
↓ 3 callers
Method
summary
(self)
examples/stage-7/03-observability/starter.py:66
↓ 3 callers
Function
tool_lookup_fact
假的事實查詢(避免依賴外部 API、教學專用)。
examples/stage-3/03-react-from-scratch/starter_anthropic.py:44
↓ 3 callers
Function
tool_lookup_fact
假的事實查詢(教學專用、避免依賴外部 API)。
examples/stage-3/03-react-from-scratch/starter.py:48
↓ 3 callers
Function
tool_schema
(name: str, description: str, field: str, field_description: str)
examples/stage-3/02-multi-tool-selection/starter_anthropic.py:48
↓ 2 callers
Function
_first_h1
Index of the first `# ` H1 line, or None.
scripts/sync-language-switchers.py:172
↓ 2 callers
Method
add_span
(self, name: str, latency_ms: float, **extras)
examples/stage-7/03-observability/starter.py:53
↓ 2 callers
Function
agent_call
(message: str, max_tokens: int, llm: Any = None)
examples/stage-7/05-deploy/starter.py:56
↓ 2 callers
Function
block_text
(text: str)
examples/stage-3/06-schema-design/test_anthropic.py:23
↓ 2 callers
Function
block_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/06-schema-design/test_anthropic.py:27
↓ 2 callers
Function
build_agent
(model: Any = None)
examples/stage-4/05-typed-agent/starter.py:50
↓ 2 callers
Function
build_agent
(model: Any = None)
examples/stage-4/04-codeact-vs-json-tool/starter.py:71
↓ 2 callers
Function
build_crew
(topic: str, llm_model: str = MODEL)
examples/stage-4/02-multi-agent-roles/starter.py:55
↓ 2 callers
Function
calculator
(expression: str)
examples/stage-3/02-multi-tool-selection/starter_anthropic.py:33
↓ 2 callers
Function
calculator
(expression: str)
examples/stage-3/02-multi-tool-selection/starter.py:40
↓ 2 callers
Function
chat_anthropic
(user_msg: str, memory: MemoryStore, client: Any = None)
examples/stage-6/05-long-term-memory/starter_anthropic.py:27
↓ 2 callers
Function
chunk_doc
Simple heading-aware chunking.
examples/stage-6/04-full-rag-pipeline/starter.py:56
↓ 2 callers
Function
collect_anchors
All anchor slugs available in this file (from H1-H6).
scripts/check-anchors.py:103
↓ 2 callers
Function
compare_strategies
3 種 chunking、跑同樣 query、回傳對比結果。
examples/stage-6/03-chunking-comparison/starter.py:90
↓ 2 callers
Function
debate_anthropic
(question: str, client: Any = None)
examples/stage-7/01-multi-agent-debate/starter_anthropic.py:34
↓ 2 callers
Function
embed
Encode a list of strings to vectors (L2-normalized).
examples/stage-6/01-embeddings/starter.py:43
↓ 2 callers
Function
eval_llm_as_judge
Use an LLM to judge whether output answers the question correctly.
examples/stage-7/02-eval/starter.py:62
next →
1–100 of 391, ranked by callers