model-client-and-generator-workflows
Use AdalFlow ModelClient, Generator, and Embedder workflows for provider integration, prompt/model kwargs, output processors, caching, streaming basics, and no-credential fake-client tests.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-client-and-generator-workflows
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use AdalFlow ModelClient, Generator, and Embedder workflows for provider integration, prompt/model kwargs, output processors, caching, streaming basics, and no-credential fake-client tests.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md7.5 KB
- 参考文档references/generator-workflows.md11.6 KB
- 参考文档references/model-clients.md9.7 KB
- 参考文档references/troubleshooting.md9.8 KB
- 脚本scripts/generator_fake_client_smoke.py6.8 KB
03 SKILL.md 正文
Model Client and Generator Workflows
Use this sub-skill when a task involves AdalFlow model-provider plumbing rather than retrieval, agents, optimization, or tracing.
Load when
- Building or debugging
Generator,ModelClient,Embedder, orBatchEmbedderflows. - Selecting provider clients or optional extras for OpenAI/OpenAI-compatible, Anthropic, Groq, Google, Ollama, Together, Cohere, Azure, Bedrock, Fireworks, Mistral, DeepSeek, XAI, SambaNova, or local Transformer integrations.
- Configuring prompt templates,
prompt_kwargs,model_kwargs,ModelType, output processors, cache behavior, or streaming response handling. - Writing no-network tests with a fake
ModelClient.
Route elsewhere
- RAG, indexes, retrievers,
LocalDB, vector stores, and document pipelines: useretrieval-rag-and-data-pipelines. - Agent, Runner, ReAct, FunctionTool, tool streaming, permissions, and MCP: use
agents-tools-and-streaming. - Evaluation, datasets,
Trainer, optimizers, text gradients, and few-shot training: useevaluation-and-optimization. - Logging, generator-state/call loggers, callback tracing, MLflow, and config utilities: use
tracing-observability-and-configuration. - Core
Component,Prompt,DataClass, and parser schema construction without model calls: usecore-components-and-structured-io.
Internal references
- Generator workflows: prompt rendering, call/acall/forward, output processors, caching, streaming, fake-client tests, embedder orchestration.
- Model clients: protocol requirements, provider extras/lazy imports, provider notes, OpenAI-compatible patterns, direct client usage.
- API reference: verified signatures, return fields,
ModelType,GeneratorOutput,EmbedderOutput, and concise call contracts. - Troubleshooting: optional SDK/API-key errors, bad
model_kwargs, parser failures,GeneratorOutput.error, cache surprises, streaming, and image/content formatting. - Fake-client smoke script: deterministic no-credential sanity check for
Generator,JsonParser,Embedder, andBatchEmbedder.
Operating checklist
- Decide whether the workflow is service-free or requires a live provider. Prefer the bundled fake-client script for unit tests and examples.
- Pick the correct
ModelType:LLMfor text generation,LLM_REASONINGfor reasoning-compatible LLM endpoints,EMBEDDERfor embeddings, and provider-specific types only after checking support. - Keep
model_kwargsprovider-shaped and JSON-serializable when caching is enabled. Pass per-call overrides throughGenerator.call(..., model_kwargs={...})orEmbedder.call(..., model_kwargs={...}). - Render and inspect the prompt with
generator.get_prompt(...)before blaming the provider. Missing or mismatched Jinja variables usually become poor prompts, not provider errors. - Treat
GeneratorOutput.erroras the authoritative failure signal. Checkraw_response,api_response, and parser configuration before retrying live API calls. - For streaming, consume
raw_response/stream_events()and do not expect structured output processors to run until a complete text response is available. - Do not embed API keys in generated code or logs. Use provider environment variables or explicit runtime configuration supplied by the caller.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).