MCPcopy Create free account

hub / github.com/WenyuChiou/awesome-agentic-ai-zh / functions

Functions391 in github.com/WenyuChiou/awesome-agentic-ai-zh

↓ 11 callersFunctionmake_resp
(finish_reason: str, content: str = "", tool_calls=None)
examples/stage-3/04-multi-step-reasoning/test.py:35
↓ 10 callersFunctionblock_text
(text: str)
examples/stage-3/04-multi-step-reasoning/test_anthropic.py:22
↓ 10 callersFunctionmake_resp
(stop_reason: str, *blocks)
examples/stage-3/04-multi-step-reasoning/test_anthropic.py:30
↓ 9 callersFunctionmake_tool_call
(call_id: str, name: str, args: dict)
examples/stage-3/04-multi-step-reasoning/test.py:27
↓ 8 callersFunctionblock_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/04-multi-step-reasoning/test_anthropic.py:26
↓ 8 callersFunctionmake_resp
(finish_reason: str, content: str = "", tool_calls=None)
examples/stage-3/05-error-handling/test.py:36
↓ 7 callersFunction_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 callersFunctionblock_text
(s: str)
examples/stage-3/03-react-from-scratch/test_anthropic.py:29
↓ 7 callersFunctionmake_resp
Build a fake OpenAI chat.completions response.
examples/stage-3/03-react-from-scratch/test.py:40
↓ 7 callersFunctionmake_resp
(stop_reason: str, *blocks)
examples/stage-3/03-react-from-scratch/test_anthropic.py:37
↓ 7 callersFunctionrun
跑一輪含 HITL 的 workflow。`approve` 模擬人類審核決定。
examples/stage-4/03-graph-workflow/starter.py:105
↓ 7 callersFunctionsemantic_query
Semantic search.
examples/stage-6/02-vector-db/starter.py:71
↓ 7 callersFunctionwith_retry
Exponential backoff retry。 - RETRIABLE 例外 → 等 base * 2^attempt 秒再試(含 jitter) - 不 retriable 例外(譬如 AuthenticationError)→ 直接 raise、不浪費時間
examples/stage-1/05-error-handling/starter_anthropic.py:45
↓ 7 callersFunctionwith_retry
Exponential backoff retry。 - RETRIABLE 例外 → 等 base * 2^attempt 秒再試(含 jitter) - 不 retriable 例外(譬如 AuthenticationError)→ 直接 raise、不浪費時間
examples/stage-1/05-error-handling/starter.py:55
↓ 6 callersFunctionblock_text
(text: str)
examples/stage-3/05-error-handling/test_anthropic.py:22
↓ 6 callersFunctionbuild_collection
建立 / 取回 chroma collection。path=':memory:' 表 in-memory。
examples/stage-6/02-vector-db/starter.py:39
↓ 6 callersFunctionindex_docs
Bulk add docs to collection.
examples/stage-6/02-vector-db/starter.py:54
↓ 6 callersFunctionmake_chunk
(delta)
examples/stage-7/04-sdk-advanced/test.py:17
↓ 6 callersFunctionmake_resp
(stop_reason: str, *blocks)
examples/stage-3/05-error-handling/test_anthropic.py:30
↓ 6 callersMethodremember
Add a fact to memory. Returns the memory id.
examples/stage-6/05-long-term-memory/starter.py:48
↓ 5 callersFunctionblock_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/03-react-from-scratch/test_anthropic.py:33
↓ 5 callersFunctionfresh_memory
每個 test 用獨立 collection 避免 EphemeralClient 跨 test 共享 state。
examples/stage-6/05-long-term-memory/test.py:17
↓ 5 callersFunctionmake_tool_call
(call_id: str, name: str, args: dict)
examples/stage-3/05-error-handling/test.py:28
↓ 5 callersFunctionmake_tool_call
(call_id: str, name: str, args: dict)
examples/stage-3/03-react-from-scratch/test.py:32
↓ 5 callersFunctionmaybe_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 callersFunctionrun_tool_selection
單輪 call:LLM 看完 question + tools 後選一個 tool 呼叫,本地執行 observation 接回去。
examples/stage-3/02-multi-tool-selection/starter.py:89
↓ 5 callersFunctionset_weather_failures
(plan: list[bool])
examples/stage-3/05-error-handling/starter.py:39
↓ 5 callersFunctiontrace_span
Context manager 計時 + 記 span。
examples/stage-7/03-observability/starter.py:79
↓ 5 callersFunctionupdate_file
更新單一檔案的 switcher。回傳 True 表示有改動需要寫入。
scripts/sync-language-switchers.py:219
↓ 4 callersFunction_rel
repo-relative path for logging; falls back to the name for temp/selftest files.
scripts/sync-language-switchers.py:164
↓ 4 callersFunctionblock_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/05-error-handling/test_anthropic.py:26
↓ 4 callersFunctioncalculator
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 callersFunctionfind_nearest
Returns top-k nearest sentences with cosine similarity scores.
examples/stage-6/01-embeddings/starter.py:49
↓ 4 callersFunctionhex_to_rgb
(h: str)
scripts/generate-stage5-stack.py:82
↓ 4 callersFunctionllm_call
(system: str, user: str, llm: Any = None)
examples/stage-7/01-multi-agent-debate/starter.py:29
↓ 4 callersFunctionmake_inline_switcher
一般檔 blockquote 一行 switcher。
scripts/sync-language-switchers.py:104
↓ 4 callersFunctionrag
Full RAG pipeline.
examples/stage-6/04-full-rag-pipeline/starter.py:99
↓ 4 callersFunctionreact_loop
OpenAI-compat 多步驟 ReAct loop。
examples/stage-3/04-multi-step-reasoning/starter.py:119
↓ 4 callersFunctionreact_loop
OpenAI-compat ReAct loop。tool error 是結構化 JSON、放進 tool_result 給 LLM 看。
examples/stage-3/05-error-handling/starter.py:68
↓ 4 callersFunctionreact_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 callersFunctionreact_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 callersMethodrecall
Retrieve top-k relevant memories.
examples/stage-6/05-long-term-memory/starter.py:54
↓ 4 callersFunctionrun
Public entrypoint: 跑一輪 agent、回傳 final message + steps。
examples/stage-4/01-same-agent-two-frameworks/starter.py:82
↓ 4 callersFunctionrun_tool_selection
(question: str, client: Any = None)
examples/stage-3/02-multi-tool-selection/starter_anthropic.py:65
↓ 4 callersFunctionset_weather_failures
(plan: list[bool])
examples/stage-3/05-error-handling/starter_anthropic.py:32
↓ 4 callersFunctiontool_calculator
安全的計算器:只允許 + - * / 跟數字。
examples/stage-3/03-react-from-scratch/starter_anthropic.py:33
↓ 4 callersFunctiontool_calculator
安全的計算器:只允許 + - * / 跟數字。
examples/stage-3/03-react-from-scratch/starter.py:37
↓ 3 callersFunction_make_connection_error
openai.APIConnectionError 需要 request 參數、用 MagicMock 假裝。
examples/stage-1/05-error-handling/test.py:30
↓ 3 callersFunction_make_connection_error
anthropic.APIConnectionError 需要 request 參數、用 MagicMock 假裝。
examples/stage-1/05-error-handling/test_anthropic.py:29
↓ 3 callersFunction_wrap
(name: str, description: str, field: str, field_description: str)
examples/stage-3/02-multi-tool-selection/starter.py:59
↓ 3 callersMethodadd_tokens
(self, input_t: int, output_t: int)
examples/stage-7/03-observability/starter.py:58
↓ 3 callersFunctionbuild_kb
(doc: str)
examples/stage-6/04-full-rag-pipeline/starter.py:63
↓ 3 callersFunctioncached_query
示範 prompt caching:第一次 call 沒 cache、第二次 hit cache、看 usage 差異。
examples/stage-7/04-sdk-advanced/starter_anthropic.py:40
↓ 3 callersFunctionchat
One conversation turn with memory recall + storage.
examples/stage-6/05-long-term-memory/starter.py:69
↓ 3 callersFunctionchunk_fixed
固定長度切(with overlap)。簡單但會切壞句子 / 段落。
examples/stage-6/03-chunking-comparison/starter.py:55
↓ 3 callersFunctionchunk_headings
Heading-aware:按 # / ## 切、每個 section 含 heading + body、有 hierarchy 標記。
examples/stage-6/03-chunking-comparison/starter.py:70
↓ 3 callersFunctionchunk_paragraphs
按段落切(雙 newline 為界)。保語意完整、但段落長短不一。
examples/stage-6/03-chunking-comparison/starter.py:65
↓ 3 callersFunctionclassify_node
看 query 決定要不要 search。簡化邏輯:含關鍵字「人口 / 天氣 / 最新」就 search。
examples/stage-4/03-graph-workflow/starter.py:48
↓ 3 callersFunctioncompare
(prompt: str)
examples/stage-1/04-cross-provider/starter.py:108
↓ 3 callersFunctiondebate
3-agent debate:pro / con / judge。
examples/stage-7/01-multi-agent-debate/starter.py:38
↓ 3 callersFunctiondivide
(a: float, b: float)
examples/stage-3/04-multi-step-reasoning/starter_anthropic.py:34
↓ 3 callersFunctiondivide
(a: float, b: float)
examples/stage-3/04-multi-step-reasoning/starter.py:44
↓ 3 callersFunctionembed_openai
Encode via OpenAI embeddings API.
examples/stage-6/01-embeddings/starter_anthropic.py:29
↓ 3 callersFunctioneval_substring
(output: str, case: dict)
examples/stage-7/02-eval/starter.py:58
↓ 3 callersFunctionfetch_weather
(city: str)
examples/stage-3/05-error-handling/starter_anthropic.py:37
↓ 3 callersFunctionfetch_weather
假的 weather API、用 _failure_plan 決定這次該失敗還是成功。
examples/stage-3/05-error-handling/starter.py:44
↓ 3 callersFunctionfmt_stars
(n: int)
scripts/refresh-stars.py:105
↓ 3 callersFunctionllm_call_anthropic
(system: str, user: str, client: Any = None)
examples/stage-7/01-multi-agent-debate/starter_anthropic.py:25
↓ 3 callersFunctionmake_fake_model
Mock SentenceTransformer:給定 text → vec 對應表。
examples/stage-6/01-embeddings/test.py:25
↓ 3 callersFunctionmake_llm
(responses: list[str])
examples/stage-7/01-multi-agent-debate/test.py:15
↓ 3 callersFunctionmake_mock_llm
(answer: str = "Mock answer.")
examples/stage-6/04-full-rag-pipeline/test.py:16
↓ 3 callersFunctionmock_client_for
(name: str, args: dict)
examples/stage-3/02-multi-tool-selection/test.py:42
↓ 3 callersFunctionmock_client_for
(name: str, inp: dict)
examples/stage-3/02-multi-tool-selection/test_anthropic.py:34
↓ 3 callersFunctionreact_loop
(question: str, max_iter: int = 8, client: Any = None)
examples/stage-3/04-multi-step-reasoning/starter_anthropic.py:62
↓ 3 callersFunctionreact_loop
(question: str, max_iter: int = 5, client: Any = None)
examples/stage-3/05-error-handling/starter_anthropic.py:57
↓ 3 callersFunctionretrieve
(collection: Any, query: str, top_k: int = 2)
examples/stage-6/04-full-rag-pipeline/starter.py:75
↓ 3 callersFunctionrun_eval
(cases: list[dict], agent_fn: Callable, eval_fn: Callable, **agent_kwargs)
examples/stage-7/02-eval/starter.py:82
↓ 3 callersFunctionset_gh_output
Set a GitHub Actions output variable.
scripts/check-mirror-sync.py:128
↓ 3 callersFunctionstream_response
Yield each token chunk as it arrives.
examples/stage-7/04-sdk-advanced/starter.py:30
↓ 3 callersMethodsummary
(self)
examples/stage-7/03-observability/starter.py:66
↓ 3 callersFunctiontool_lookup_fact
假的事實查詢(避免依賴外部 API、教學專用)。
examples/stage-3/03-react-from-scratch/starter_anthropic.py:44
↓ 3 callersFunctiontool_lookup_fact
假的事實查詢(教學專用、避免依賴外部 API)。
examples/stage-3/03-react-from-scratch/starter.py:48
↓ 3 callersFunctiontool_schema
(name: str, description: str, field: str, field_description: str)
examples/stage-3/02-multi-tool-selection/starter_anthropic.py:48
↓ 2 callersFunction_first_h1
Index of the first `# ` H1 line, or None.
scripts/sync-language-switchers.py:172
↓ 2 callersMethodadd_span
(self, name: str, latency_ms: float, **extras)
examples/stage-7/03-observability/starter.py:53
↓ 2 callersFunctionagent_call
(message: str, max_tokens: int, llm: Any = None)
examples/stage-7/05-deploy/starter.py:56
↓ 2 callersFunctionblock_text
(text: str)
examples/stage-3/06-schema-design/test_anthropic.py:23
↓ 2 callersFunctionblock_tool_use
(tool_id: str, name: str, inp: dict)
examples/stage-3/06-schema-design/test_anthropic.py:27
↓ 2 callersFunctionbuild_agent
(model: Any = None)
examples/stage-4/05-typed-agent/starter.py:50
↓ 2 callersFunctionbuild_agent
(model: Any = None)
examples/stage-4/04-codeact-vs-json-tool/starter.py:71
↓ 2 callersFunctionbuild_crew
(topic: str, llm_model: str = MODEL)
examples/stage-4/02-multi-agent-roles/starter.py:55
↓ 2 callersFunctioncalculator
(expression: str)
examples/stage-3/02-multi-tool-selection/starter_anthropic.py:33
↓ 2 callersFunctioncalculator
(expression: str)
examples/stage-3/02-multi-tool-selection/starter.py:40
↓ 2 callersFunctionchat_anthropic
(user_msg: str, memory: MemoryStore, client: Any = None)
examples/stage-6/05-long-term-memory/starter_anthropic.py:27
↓ 2 callersFunctionchunk_doc
Simple heading-aware chunking.
examples/stage-6/04-full-rag-pipeline/starter.py:56
↓ 2 callersFunctioncollect_anchors
All anchor slugs available in this file (from H1-H6).
scripts/check-anchors.py:103
↓ 2 callersFunctioncompare_strategies
3 種 chunking、跑同樣 query、回傳對比結果。
examples/stage-6/03-chunking-comparison/starter.py:90
↓ 2 callersFunctiondebate_anthropic
(question: str, client: Any = None)
examples/stage-7/01-multi-agent-debate/starter_anthropic.py:34
↓ 2 callersFunctionembed
Encode a list of strings to vectors (L2-normalized).
examples/stage-6/01-embeddings/starter.py:43
↓ 2 callersFunctioneval_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