@synsci/cli-darwin-x64 1.1.49
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/bin/skills/accelerate/SKILL.md +332 -0
- package/bin/skills/accelerate/references/custom-plugins.md +453 -0
- package/bin/skills/accelerate/references/megatron-integration.md +489 -0
- package/bin/skills/accelerate/references/performance.md +525 -0
- package/bin/skills/audiocraft/SKILL.md +564 -0
- package/bin/skills/audiocraft/references/advanced-usage.md +666 -0
- package/bin/skills/audiocraft/references/troubleshooting.md +504 -0
- package/bin/skills/autogpt/SKILL.md +403 -0
- package/bin/skills/autogpt/references/advanced-usage.md +535 -0
- package/bin/skills/autogpt/references/troubleshooting.md +420 -0
- package/bin/skills/awq/SKILL.md +310 -0
- package/bin/skills/awq/references/advanced-usage.md +324 -0
- package/bin/skills/awq/references/troubleshooting.md +344 -0
- package/bin/skills/axolotl/SKILL.md +158 -0
- package/bin/skills/axolotl/references/api.md +5548 -0
- package/bin/skills/axolotl/references/dataset-formats.md +1029 -0
- package/bin/skills/axolotl/references/index.md +15 -0
- package/bin/skills/axolotl/references/other.md +3563 -0
- package/bin/skills/bigcode-evaluation-harness/SKILL.md +405 -0
- package/bin/skills/bigcode-evaluation-harness/references/benchmarks.md +393 -0
- package/bin/skills/bigcode-evaluation-harness/references/custom-tasks.md +424 -0
- package/bin/skills/bigcode-evaluation-harness/references/issues.md +394 -0
- package/bin/skills/bitsandbytes/SKILL.md +411 -0
- package/bin/skills/bitsandbytes/references/memory-optimization.md +521 -0
- package/bin/skills/bitsandbytes/references/qlora-training.md +521 -0
- package/bin/skills/bitsandbytes/references/quantization-formats.md +447 -0
- package/bin/skills/blip-2/SKILL.md +564 -0
- package/bin/skills/blip-2/references/advanced-usage.md +680 -0
- package/bin/skills/blip-2/references/troubleshooting.md +526 -0
- package/bin/skills/chroma/SKILL.md +406 -0
- package/bin/skills/chroma/references/integration.md +38 -0
- package/bin/skills/clip/SKILL.md +253 -0
- package/bin/skills/clip/references/applications.md +207 -0
- package/bin/skills/constitutional-ai/SKILL.md +290 -0
- package/bin/skills/crewai/SKILL.md +498 -0
- package/bin/skills/crewai/references/flows.md +438 -0
- package/bin/skills/crewai/references/tools.md +429 -0
- package/bin/skills/crewai/references/troubleshooting.md +480 -0
- package/bin/skills/deepspeed/SKILL.md +141 -0
- package/bin/skills/deepspeed/references/08.md +17 -0
- package/bin/skills/deepspeed/references/09.md +173 -0
- package/bin/skills/deepspeed/references/2020.md +378 -0
- package/bin/skills/deepspeed/references/2023.md +279 -0
- package/bin/skills/deepspeed/references/assets.md +179 -0
- package/bin/skills/deepspeed/references/index.md +35 -0
- package/bin/skills/deepspeed/references/mii.md +118 -0
- package/bin/skills/deepspeed/references/other.md +1191 -0
- package/bin/skills/deepspeed/references/tutorials.md +6554 -0
- package/bin/skills/dspy/SKILL.md +590 -0
- package/bin/skills/dspy/references/examples.md +663 -0
- package/bin/skills/dspy/references/modules.md +475 -0
- package/bin/skills/dspy/references/optimizers.md +566 -0
- package/bin/skills/faiss/SKILL.md +221 -0
- package/bin/skills/faiss/references/index_types.md +280 -0
- package/bin/skills/flash-attention/SKILL.md +367 -0
- package/bin/skills/flash-attention/references/benchmarks.md +215 -0
- package/bin/skills/flash-attention/references/transformers-integration.md +293 -0
- package/bin/skills/gguf/SKILL.md +427 -0
- package/bin/skills/gguf/references/advanced-usage.md +504 -0
- package/bin/skills/gguf/references/troubleshooting.md +442 -0
- package/bin/skills/gptq/SKILL.md +450 -0
- package/bin/skills/gptq/references/calibration.md +337 -0
- package/bin/skills/gptq/references/integration.md +129 -0
- package/bin/skills/gptq/references/troubleshooting.md +95 -0
- package/bin/skills/grpo-rl-training/README.md +97 -0
- package/bin/skills/grpo-rl-training/SKILL.md +572 -0
- package/bin/skills/grpo-rl-training/examples/reward_functions_library.py +393 -0
- package/bin/skills/grpo-rl-training/templates/basic_grpo_training.py +228 -0
- package/bin/skills/guidance/SKILL.md +572 -0
- package/bin/skills/guidance/references/backends.md +554 -0
- package/bin/skills/guidance/references/constraints.md +674 -0
- package/bin/skills/guidance/references/examples.md +767 -0
- package/bin/skills/hqq/SKILL.md +445 -0
- package/bin/skills/hqq/references/advanced-usage.md +528 -0
- package/bin/skills/hqq/references/troubleshooting.md +503 -0
- package/bin/skills/hugging-face-cli/SKILL.md +191 -0
- package/bin/skills/hugging-face-cli/references/commands.md +954 -0
- package/bin/skills/hugging-face-cli/references/examples.md +374 -0
- package/bin/skills/hugging-face-datasets/SKILL.md +547 -0
- package/bin/skills/hugging-face-datasets/examples/diverse_training_examples.json +239 -0
- package/bin/skills/hugging-face-datasets/examples/system_prompt_template.txt +196 -0
- package/bin/skills/hugging-face-datasets/examples/training_examples.json +176 -0
- package/bin/skills/hugging-face-datasets/scripts/dataset_manager.py +522 -0
- package/bin/skills/hugging-face-datasets/scripts/sql_manager.py +844 -0
- package/bin/skills/hugging-face-datasets/templates/chat.json +55 -0
- package/bin/skills/hugging-face-datasets/templates/classification.json +62 -0
- package/bin/skills/hugging-face-datasets/templates/completion.json +51 -0
- package/bin/skills/hugging-face-datasets/templates/custom.json +75 -0
- package/bin/skills/hugging-face-datasets/templates/qa.json +54 -0
- package/bin/skills/hugging-face-datasets/templates/tabular.json +81 -0
- package/bin/skills/hugging-face-evaluation/SKILL.md +656 -0
- package/bin/skills/hugging-face-evaluation/examples/USAGE_EXAMPLES.md +382 -0
- package/bin/skills/hugging-face-evaluation/examples/artificial_analysis_to_hub.py +141 -0
- package/bin/skills/hugging-face-evaluation/examples/example_readme_tables.md +135 -0
- package/bin/skills/hugging-face-evaluation/examples/metric_mapping.json +50 -0
- package/bin/skills/hugging-face-evaluation/requirements.txt +20 -0
- package/bin/skills/hugging-face-evaluation/scripts/evaluation_manager.py +1374 -0
- package/bin/skills/hugging-face-evaluation/scripts/inspect_eval_uv.py +104 -0
- package/bin/skills/hugging-face-evaluation/scripts/inspect_vllm_uv.py +317 -0
- package/bin/skills/hugging-face-evaluation/scripts/lighteval_vllm_uv.py +303 -0
- package/bin/skills/hugging-face-evaluation/scripts/run_eval_job.py +98 -0
- package/bin/skills/hugging-face-evaluation/scripts/run_vllm_eval_job.py +331 -0
- package/bin/skills/hugging-face-evaluation/scripts/test_extraction.py +206 -0
- package/bin/skills/hugging-face-jobs/SKILL.md +1041 -0
- package/bin/skills/hugging-face-jobs/index.html +216 -0
- package/bin/skills/hugging-face-jobs/references/hardware_guide.md +336 -0
- package/bin/skills/hugging-face-jobs/references/hub_saving.md +352 -0
- package/bin/skills/hugging-face-jobs/references/token_usage.md +546 -0
- package/bin/skills/hugging-face-jobs/references/troubleshooting.md +475 -0
- package/bin/skills/hugging-face-jobs/scripts/cot-self-instruct.py +718 -0
- package/bin/skills/hugging-face-jobs/scripts/finepdfs-stats.py +546 -0
- package/bin/skills/hugging-face-jobs/scripts/generate-responses.py +587 -0
- package/bin/skills/hugging-face-model-trainer/SKILL.md +711 -0
- package/bin/skills/hugging-face-model-trainer/references/gguf_conversion.md +296 -0
- package/bin/skills/hugging-face-model-trainer/references/hardware_guide.md +283 -0
- package/bin/skills/hugging-face-model-trainer/references/hub_saving.md +364 -0
- package/bin/skills/hugging-face-model-trainer/references/reliability_principles.md +371 -0
- package/bin/skills/hugging-face-model-trainer/references/trackio_guide.md +189 -0
- package/bin/skills/hugging-face-model-trainer/references/training_methods.md +150 -0
- package/bin/skills/hugging-face-model-trainer/references/training_patterns.md +203 -0
- package/bin/skills/hugging-face-model-trainer/references/troubleshooting.md +282 -0
- package/bin/skills/hugging-face-model-trainer/scripts/convert_to_gguf.py +424 -0
- package/bin/skills/hugging-face-model-trainer/scripts/dataset_inspector.py +417 -0
- package/bin/skills/hugging-face-model-trainer/scripts/estimate_cost.py +150 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_dpo_example.py +106 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_grpo_example.py +89 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_sft_example.py +122 -0
- package/bin/skills/hugging-face-paper-publisher/SKILL.md +627 -0
- package/bin/skills/hugging-face-paper-publisher/examples/example_usage.md +327 -0
- package/bin/skills/hugging-face-paper-publisher/references/quick_reference.md +216 -0
- package/bin/skills/hugging-face-paper-publisher/scripts/paper_manager.py +508 -0
- package/bin/skills/hugging-face-paper-publisher/templates/arxiv.md +299 -0
- package/bin/skills/hugging-face-paper-publisher/templates/ml-report.md +358 -0
- package/bin/skills/hugging-face-paper-publisher/templates/modern.md +319 -0
- package/bin/skills/hugging-face-paper-publisher/templates/standard.md +201 -0
- package/bin/skills/hugging-face-tool-builder/SKILL.md +115 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.py +57 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.sh +40 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.tsx +57 -0
- package/bin/skills/hugging-face-tool-builder/references/find_models_by_paper.sh +230 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_enrich_models.sh +96 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_model_card_frontmatter.sh +188 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_model_papers_auth.sh +171 -0
- package/bin/skills/hugging-face-trackio/SKILL.md +65 -0
- package/bin/skills/hugging-face-trackio/references/logging_metrics.md +206 -0
- package/bin/skills/hugging-face-trackio/references/retrieving_metrics.md +223 -0
- package/bin/skills/huggingface-tokenizers/SKILL.md +516 -0
- package/bin/skills/huggingface-tokenizers/references/algorithms.md +653 -0
- package/bin/skills/huggingface-tokenizers/references/integration.md +637 -0
- package/bin/skills/huggingface-tokenizers/references/pipeline.md +723 -0
- package/bin/skills/huggingface-tokenizers/references/training.md +565 -0
- package/bin/skills/instructor/SKILL.md +740 -0
- package/bin/skills/instructor/references/examples.md +107 -0
- package/bin/skills/instructor/references/providers.md +70 -0
- package/bin/skills/instructor/references/validation.md +606 -0
- package/bin/skills/knowledge-distillation/SKILL.md +458 -0
- package/bin/skills/knowledge-distillation/references/minillm.md +334 -0
- package/bin/skills/lambda-labs/SKILL.md +545 -0
- package/bin/skills/lambda-labs/references/advanced-usage.md +611 -0
- package/bin/skills/lambda-labs/references/troubleshooting.md +530 -0
- package/bin/skills/langchain/SKILL.md +480 -0
- package/bin/skills/langchain/references/agents.md +499 -0
- package/bin/skills/langchain/references/integration.md +562 -0
- package/bin/skills/langchain/references/rag.md +600 -0
- package/bin/skills/langsmith/SKILL.md +422 -0
- package/bin/skills/langsmith/references/advanced-usage.md +548 -0
- package/bin/skills/langsmith/references/troubleshooting.md +537 -0
- package/bin/skills/litgpt/SKILL.md +469 -0
- package/bin/skills/litgpt/references/custom-models.md +568 -0
- package/bin/skills/litgpt/references/distributed-training.md +451 -0
- package/bin/skills/litgpt/references/supported-models.md +336 -0
- package/bin/skills/litgpt/references/training-recipes.md +619 -0
- package/bin/skills/llama-cpp/SKILL.md +258 -0
- package/bin/skills/llama-cpp/references/optimization.md +89 -0
- package/bin/skills/llama-cpp/references/quantization.md +213 -0
- package/bin/skills/llama-cpp/references/server.md +125 -0
- package/bin/skills/llama-factory/SKILL.md +80 -0
- package/bin/skills/llama-factory/references/_images.md +23 -0
- package/bin/skills/llama-factory/references/advanced.md +1055 -0
- package/bin/skills/llama-factory/references/getting_started.md +349 -0
- package/bin/skills/llama-factory/references/index.md +19 -0
- package/bin/skills/llama-factory/references/other.md +31 -0
- package/bin/skills/llamaguard/SKILL.md +337 -0
- package/bin/skills/llamaindex/SKILL.md +569 -0
- package/bin/skills/llamaindex/references/agents.md +83 -0
- package/bin/skills/llamaindex/references/data_connectors.md +108 -0
- package/bin/skills/llamaindex/references/query_engines.md +406 -0
- package/bin/skills/llava/SKILL.md +304 -0
- package/bin/skills/llava/references/training.md +197 -0
- package/bin/skills/lm-evaluation-harness/SKILL.md +490 -0
- package/bin/skills/lm-evaluation-harness/references/api-evaluation.md +490 -0
- package/bin/skills/lm-evaluation-harness/references/benchmark-guide.md +488 -0
- package/bin/skills/lm-evaluation-harness/references/custom-tasks.md +602 -0
- package/bin/skills/lm-evaluation-harness/references/distributed-eval.md +519 -0
- package/bin/skills/long-context/SKILL.md +536 -0
- package/bin/skills/long-context/references/extension_methods.md +468 -0
- package/bin/skills/long-context/references/fine_tuning.md +611 -0
- package/bin/skills/long-context/references/rope.md +402 -0
- package/bin/skills/mamba/SKILL.md +260 -0
- package/bin/skills/mamba/references/architecture-details.md +206 -0
- package/bin/skills/mamba/references/benchmarks.md +255 -0
- package/bin/skills/mamba/references/training-guide.md +388 -0
- package/bin/skills/megatron-core/SKILL.md +366 -0
- package/bin/skills/megatron-core/references/benchmarks.md +249 -0
- package/bin/skills/megatron-core/references/parallelism-guide.md +404 -0
- package/bin/skills/megatron-core/references/production-examples.md +473 -0
- package/bin/skills/megatron-core/references/training-recipes.md +547 -0
- package/bin/skills/miles/SKILL.md +315 -0
- package/bin/skills/miles/references/api-reference.md +141 -0
- package/bin/skills/miles/references/troubleshooting.md +352 -0
- package/bin/skills/mlflow/SKILL.md +704 -0
- package/bin/skills/mlflow/references/deployment.md +744 -0
- package/bin/skills/mlflow/references/model-registry.md +770 -0
- package/bin/skills/mlflow/references/tracking.md +680 -0
- package/bin/skills/modal/SKILL.md +341 -0
- package/bin/skills/modal/references/advanced-usage.md +503 -0
- package/bin/skills/modal/references/troubleshooting.md +494 -0
- package/bin/skills/model-merging/SKILL.md +539 -0
- package/bin/skills/model-merging/references/evaluation.md +462 -0
- package/bin/skills/model-merging/references/examples.md +428 -0
- package/bin/skills/model-merging/references/methods.md +352 -0
- package/bin/skills/model-pruning/SKILL.md +495 -0
- package/bin/skills/model-pruning/references/wanda.md +347 -0
- package/bin/skills/moe-training/SKILL.md +526 -0
- package/bin/skills/moe-training/references/architectures.md +432 -0
- package/bin/skills/moe-training/references/inference.md +348 -0
- package/bin/skills/moe-training/references/training.md +425 -0
- package/bin/skills/nanogpt/SKILL.md +290 -0
- package/bin/skills/nanogpt/references/architecture.md +382 -0
- package/bin/skills/nanogpt/references/data.md +476 -0
- package/bin/skills/nanogpt/references/training.md +564 -0
- package/bin/skills/nemo-curator/SKILL.md +383 -0
- package/bin/skills/nemo-curator/references/deduplication.md +87 -0
- package/bin/skills/nemo-curator/references/filtering.md +102 -0
- package/bin/skills/nemo-evaluator/SKILL.md +494 -0
- package/bin/skills/nemo-evaluator/references/adapter-system.md +340 -0
- package/bin/skills/nemo-evaluator/references/configuration.md +447 -0
- package/bin/skills/nemo-evaluator/references/custom-benchmarks.md +315 -0
- package/bin/skills/nemo-evaluator/references/execution-backends.md +361 -0
- package/bin/skills/nemo-guardrails/SKILL.md +297 -0
- package/bin/skills/nnsight/SKILL.md +436 -0
- package/bin/skills/nnsight/references/README.md +78 -0
- package/bin/skills/nnsight/references/api.md +344 -0
- package/bin/skills/nnsight/references/tutorials.md +300 -0
- package/bin/skills/openrlhf/SKILL.md +249 -0
- package/bin/skills/openrlhf/references/algorithm-comparison.md +404 -0
- package/bin/skills/openrlhf/references/custom-rewards.md +530 -0
- package/bin/skills/openrlhf/references/hybrid-engine.md +287 -0
- package/bin/skills/openrlhf/references/multi-node-training.md +454 -0
- package/bin/skills/outlines/SKILL.md +652 -0
- package/bin/skills/outlines/references/backends.md +615 -0
- package/bin/skills/outlines/references/examples.md +773 -0
- package/bin/skills/outlines/references/json_generation.md +652 -0
- package/bin/skills/peft/SKILL.md +431 -0
- package/bin/skills/peft/references/advanced-usage.md +514 -0
- package/bin/skills/peft/references/troubleshooting.md +480 -0
- package/bin/skills/phoenix/SKILL.md +475 -0
- package/bin/skills/phoenix/references/advanced-usage.md +619 -0
- package/bin/skills/phoenix/references/troubleshooting.md +538 -0
- package/bin/skills/pinecone/SKILL.md +358 -0
- package/bin/skills/pinecone/references/deployment.md +181 -0
- package/bin/skills/pytorch-fsdp/SKILL.md +126 -0
- package/bin/skills/pytorch-fsdp/references/index.md +7 -0
- package/bin/skills/pytorch-fsdp/references/other.md +4249 -0
- package/bin/skills/pytorch-lightning/SKILL.md +346 -0
- package/bin/skills/pytorch-lightning/references/callbacks.md +436 -0
- package/bin/skills/pytorch-lightning/references/distributed.md +490 -0
- package/bin/skills/pytorch-lightning/references/hyperparameter-tuning.md +556 -0
- package/bin/skills/pyvene/SKILL.md +473 -0
- package/bin/skills/pyvene/references/README.md +73 -0
- package/bin/skills/pyvene/references/api.md +383 -0
- package/bin/skills/pyvene/references/tutorials.md +376 -0
- package/bin/skills/qdrant/SKILL.md +493 -0
- package/bin/skills/qdrant/references/advanced-usage.md +648 -0
- package/bin/skills/qdrant/references/troubleshooting.md +631 -0
- package/bin/skills/ray-data/SKILL.md +326 -0
- package/bin/skills/ray-data/references/integration.md +82 -0
- package/bin/skills/ray-data/references/transformations.md +83 -0
- package/bin/skills/ray-train/SKILL.md +406 -0
- package/bin/skills/ray-train/references/multi-node.md +628 -0
- package/bin/skills/rwkv/SKILL.md +260 -0
- package/bin/skills/rwkv/references/architecture-details.md +344 -0
- package/bin/skills/rwkv/references/rwkv7.md +386 -0
- package/bin/skills/rwkv/references/state-management.md +369 -0
- package/bin/skills/saelens/SKILL.md +386 -0
- package/bin/skills/saelens/references/README.md +70 -0
- package/bin/skills/saelens/references/api.md +333 -0
- package/bin/skills/saelens/references/tutorials.md +318 -0
- package/bin/skills/segment-anything/SKILL.md +500 -0
- package/bin/skills/segment-anything/references/advanced-usage.md +589 -0
- package/bin/skills/segment-anything/references/troubleshooting.md +484 -0
- package/bin/skills/sentence-transformers/SKILL.md +255 -0
- package/bin/skills/sentence-transformers/references/models.md +123 -0
- package/bin/skills/sentencepiece/SKILL.md +235 -0
- package/bin/skills/sentencepiece/references/algorithms.md +200 -0
- package/bin/skills/sentencepiece/references/training.md +304 -0
- package/bin/skills/sglang/SKILL.md +442 -0
- package/bin/skills/sglang/references/deployment.md +490 -0
- package/bin/skills/sglang/references/radix-attention.md +413 -0
- package/bin/skills/sglang/references/structured-generation.md +541 -0
- package/bin/skills/simpo/SKILL.md +219 -0
- package/bin/skills/simpo/references/datasets.md +478 -0
- package/bin/skills/simpo/references/hyperparameters.md +452 -0
- package/bin/skills/simpo/references/loss-functions.md +350 -0
- package/bin/skills/skypilot/SKILL.md +509 -0
- package/bin/skills/skypilot/references/advanced-usage.md +491 -0
- package/bin/skills/skypilot/references/troubleshooting.md +570 -0
- package/bin/skills/slime/SKILL.md +464 -0
- package/bin/skills/slime/references/api-reference.md +392 -0
- package/bin/skills/slime/references/troubleshooting.md +386 -0
- package/bin/skills/speculative-decoding/SKILL.md +467 -0
- package/bin/skills/speculative-decoding/references/lookahead.md +309 -0
- package/bin/skills/speculative-decoding/references/medusa.md +350 -0
- package/bin/skills/stable-diffusion/SKILL.md +519 -0
- package/bin/skills/stable-diffusion/references/advanced-usage.md +716 -0
- package/bin/skills/stable-diffusion/references/troubleshooting.md +555 -0
- package/bin/skills/tensorboard/SKILL.md +629 -0
- package/bin/skills/tensorboard/references/integrations.md +638 -0
- package/bin/skills/tensorboard/references/profiling.md +545 -0
- package/bin/skills/tensorboard/references/visualization.md +620 -0
- package/bin/skills/tensorrt-llm/SKILL.md +187 -0
- package/bin/skills/tensorrt-llm/references/multi-gpu.md +298 -0
- package/bin/skills/tensorrt-llm/references/optimization.md +242 -0
- package/bin/skills/tensorrt-llm/references/serving.md +470 -0
- package/bin/skills/tinker/SKILL.md +362 -0
- package/bin/skills/tinker/references/api-reference.md +168 -0
- package/bin/skills/tinker/references/getting-started.md +157 -0
- package/bin/skills/tinker/references/loss-functions.md +163 -0
- package/bin/skills/tinker/references/models-and-lora.md +139 -0
- package/bin/skills/tinker/references/recipes.md +280 -0
- package/bin/skills/tinker/references/reinforcement-learning.md +212 -0
- package/bin/skills/tinker/references/rendering.md +243 -0
- package/bin/skills/tinker/references/supervised-learning.md +232 -0
- package/bin/skills/tinker-training-cost/SKILL.md +187 -0
- package/bin/skills/tinker-training-cost/scripts/calculate_cost.py +123 -0
- package/bin/skills/torchforge/SKILL.md +433 -0
- package/bin/skills/torchforge/references/api-reference.md +327 -0
- package/bin/skills/torchforge/references/troubleshooting.md +409 -0
- package/bin/skills/torchtitan/SKILL.md +358 -0
- package/bin/skills/torchtitan/references/checkpoint.md +181 -0
- package/bin/skills/torchtitan/references/custom-models.md +258 -0
- package/bin/skills/torchtitan/references/float8.md +133 -0
- package/bin/skills/torchtitan/references/fsdp.md +126 -0
- package/bin/skills/transformer-lens/SKILL.md +346 -0
- package/bin/skills/transformer-lens/references/README.md +54 -0
- package/bin/skills/transformer-lens/references/api.md +362 -0
- package/bin/skills/transformer-lens/references/tutorials.md +339 -0
- package/bin/skills/trl-fine-tuning/SKILL.md +455 -0
- package/bin/skills/trl-fine-tuning/references/dpo-variants.md +227 -0
- package/bin/skills/trl-fine-tuning/references/online-rl.md +82 -0
- package/bin/skills/trl-fine-tuning/references/reward-modeling.md +122 -0
- package/bin/skills/trl-fine-tuning/references/sft-training.md +168 -0
- package/bin/skills/unsloth/SKILL.md +80 -0
- package/bin/skills/unsloth/references/index.md +7 -0
- package/bin/skills/unsloth/references/llms-full.md +16799 -0
- package/bin/skills/unsloth/references/llms-txt.md +12044 -0
- package/bin/skills/unsloth/references/llms.md +82 -0
- package/bin/skills/verl/SKILL.md +391 -0
- package/bin/skills/verl/references/api-reference.md +301 -0
- package/bin/skills/verl/references/troubleshooting.md +391 -0
- package/bin/skills/vllm/SKILL.md +364 -0
- package/bin/skills/vllm/references/optimization.md +226 -0
- package/bin/skills/vllm/references/quantization.md +284 -0
- package/bin/skills/vllm/references/server-deployment.md +255 -0
- package/bin/skills/vllm/references/troubleshooting.md +447 -0
- package/bin/skills/weights-and-biases/SKILL.md +590 -0
- package/bin/skills/weights-and-biases/references/artifacts.md +584 -0
- package/bin/skills/weights-and-biases/references/integrations.md +700 -0
- package/bin/skills/weights-and-biases/references/sweeps.md +847 -0
- package/bin/skills/whisper/SKILL.md +317 -0
- package/bin/skills/whisper/references/languages.md +189 -0
- package/bin/synsc +0 -0
- package/package.json +10 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
# AutoGPT Advanced Usage Guide
|
|
2
|
+
|
|
3
|
+
## Custom Block Development
|
|
4
|
+
|
|
5
|
+
### Block structure
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from backend.data.block import Block, BlockSchema, BlockType
|
|
9
|
+
from pydantic import BaseModel
|
|
10
|
+
|
|
11
|
+
class MyBlockInput(BaseModel):
|
|
12
|
+
"""Input schema for the block."""
|
|
13
|
+
query: str
|
|
14
|
+
max_results: int = 10
|
|
15
|
+
|
|
16
|
+
class MyBlockOutput(BaseModel):
|
|
17
|
+
"""Output schema for the block."""
|
|
18
|
+
results: list[str]
|
|
19
|
+
count: int
|
|
20
|
+
|
|
21
|
+
class MyCustomBlock(Block):
|
|
22
|
+
"""Custom block for specific functionality."""
|
|
23
|
+
|
|
24
|
+
id = "my-custom-block-uuid"
|
|
25
|
+
name = "My Custom Block"
|
|
26
|
+
description = "Does something specific"
|
|
27
|
+
block_type = BlockType.STANDARD
|
|
28
|
+
|
|
29
|
+
input_schema = MyBlockInput
|
|
30
|
+
output_schema = MyBlockOutput
|
|
31
|
+
|
|
32
|
+
async def execute(self, input_data: MyBlockInput) -> dict:
|
|
33
|
+
"""Execute the block logic."""
|
|
34
|
+
# Implement your logic
|
|
35
|
+
results = await self.process(input_data.query, input_data.max_results)
|
|
36
|
+
|
|
37
|
+
yield "results", results
|
|
38
|
+
yield "count", len(results)
|
|
39
|
+
|
|
40
|
+
async def process(self, query: str, max_results: int) -> list[str]:
|
|
41
|
+
"""Internal processing logic."""
|
|
42
|
+
# Implementation
|
|
43
|
+
return ["result1", "result2"]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Block registration
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
# backend/blocks/__init__.py
|
|
50
|
+
from backend.blocks.my_block import MyCustomBlock
|
|
51
|
+
|
|
52
|
+
# Add to block registry
|
|
53
|
+
BLOCKS = [
|
|
54
|
+
MyCustomBlock,
|
|
55
|
+
# ... other blocks
|
|
56
|
+
]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Block with credentials
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from backend.data.block import Block
|
|
63
|
+
from backend.integrations.providers import ProviderName
|
|
64
|
+
|
|
65
|
+
class APIIntegrationBlock(Block):
|
|
66
|
+
"""Block that uses external API credentials."""
|
|
67
|
+
|
|
68
|
+
credentials_required = [ProviderName.OPENAI]
|
|
69
|
+
|
|
70
|
+
async def execute(self, input_data):
|
|
71
|
+
# Get credentials from the system
|
|
72
|
+
credentials = await self.get_credentials(ProviderName.OPENAI)
|
|
73
|
+
|
|
74
|
+
# Use credentials
|
|
75
|
+
client = OpenAI(api_key=credentials.api_key)
|
|
76
|
+
|
|
77
|
+
response = await client.chat.completions.create(
|
|
78
|
+
model="gpt-4o",
|
|
79
|
+
messages=[{"role": "user", "content": input_data.prompt}]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
yield "response", response.choices[0].message.content
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Block with cost tracking
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from backend.data.block import Block
|
|
89
|
+
from backend.data.block_cost_config import BlockCostConfig
|
|
90
|
+
|
|
91
|
+
class LLMBlock(Block):
|
|
92
|
+
"""Block with cost tracking."""
|
|
93
|
+
|
|
94
|
+
cost_config = BlockCostConfig(
|
|
95
|
+
cost_type="token",
|
|
96
|
+
cost_per_unit=0.00002, # Per token
|
|
97
|
+
provider="openai"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
async def execute(self, input_data):
|
|
101
|
+
response = await self.call_llm(input_data.prompt)
|
|
102
|
+
|
|
103
|
+
# Report token usage for cost tracking
|
|
104
|
+
self.report_usage(
|
|
105
|
+
input_tokens=response.usage.prompt_tokens,
|
|
106
|
+
output_tokens=response.usage.completion_tokens
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
yield "output", response.content
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Advanced Execution Patterns
|
|
113
|
+
|
|
114
|
+
### Parallel node execution
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from backend.executor.manager import ExecutionManager
|
|
118
|
+
|
|
119
|
+
async def execute_parallel_nodes(graph_exec_id: str, node_ids: list[str]):
|
|
120
|
+
"""Execute multiple nodes in parallel."""
|
|
121
|
+
manager = ExecutionManager()
|
|
122
|
+
|
|
123
|
+
tasks = [
|
|
124
|
+
manager.execute_node(graph_exec_id, node_id)
|
|
125
|
+
for node_id in node_ids
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
results = await asyncio.gather(*tasks)
|
|
129
|
+
return results
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Conditional branching
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from backend.blocks.branching import BranchingBlock
|
|
136
|
+
|
|
137
|
+
class SmartBranchBlock(BranchingBlock):
|
|
138
|
+
"""Advanced conditional branching."""
|
|
139
|
+
|
|
140
|
+
async def execute(self, input_data):
|
|
141
|
+
condition = await self.evaluate_condition(input_data)
|
|
142
|
+
|
|
143
|
+
if condition == "path_a":
|
|
144
|
+
yield "output_a", input_data.value
|
|
145
|
+
elif condition == "path_b":
|
|
146
|
+
yield "output_b", input_data.value
|
|
147
|
+
else:
|
|
148
|
+
yield "output_default", input_data.value
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Loop execution
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
class LoopBlock(Block):
|
|
155
|
+
"""Execute a subgraph in a loop."""
|
|
156
|
+
|
|
157
|
+
async def execute(self, input_data):
|
|
158
|
+
items = input_data.items
|
|
159
|
+
results = []
|
|
160
|
+
|
|
161
|
+
for i, item in enumerate(items):
|
|
162
|
+
# Execute nested graph for each item
|
|
163
|
+
result = await self.execute_subgraph(
|
|
164
|
+
graph_id=input_data.subgraph_id,
|
|
165
|
+
inputs={"item": item, "index": i}
|
|
166
|
+
)
|
|
167
|
+
results.append(result)
|
|
168
|
+
|
|
169
|
+
yield "progress", f"Processed {i+1}/{len(items)}"
|
|
170
|
+
|
|
171
|
+
yield "results", results
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Graph composition
|
|
175
|
+
|
|
176
|
+
### Nested agents
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from backend.blocks.agent import AgentExecutorBlock
|
|
180
|
+
|
|
181
|
+
class ParentAgentBlock(Block):
|
|
182
|
+
"""Execute child agents within a parent agent."""
|
|
183
|
+
|
|
184
|
+
async def execute(self, input_data):
|
|
185
|
+
# Execute child agent
|
|
186
|
+
child_result = await self.execute_agent(
|
|
187
|
+
agent_id=input_data.child_agent_id,
|
|
188
|
+
inputs={"query": input_data.query}
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# Process child result
|
|
192
|
+
processed = await self.process_result(child_result)
|
|
193
|
+
|
|
194
|
+
yield "output", processed
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Dynamic graph construction
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
from backend.data.graph import GraphModel, NodeModel, LinkModel
|
|
201
|
+
|
|
202
|
+
async def create_dynamic_graph(user_id: str, template: str):
|
|
203
|
+
"""Create a graph dynamically based on template."""
|
|
204
|
+
graph = GraphModel(
|
|
205
|
+
name=f"Dynamic Graph - {template}",
|
|
206
|
+
description="Auto-generated graph",
|
|
207
|
+
user_id=user_id
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
# Add nodes based on template
|
|
211
|
+
nodes = []
|
|
212
|
+
if template == "research":
|
|
213
|
+
nodes = [
|
|
214
|
+
NodeModel(block_id="search-block", position={"x": 0, "y": 0}),
|
|
215
|
+
NodeModel(block_id="summarize-block", position={"x": 200, "y": 0}),
|
|
216
|
+
NodeModel(block_id="output-block", position={"x": 400, "y": 0})
|
|
217
|
+
]
|
|
218
|
+
elif template == "code-review":
|
|
219
|
+
nodes = [
|
|
220
|
+
NodeModel(block_id="github-block", position={"x": 0, "y": 0}),
|
|
221
|
+
NodeModel(block_id="review-block", position={"x": 200, "y": 0}),
|
|
222
|
+
NodeModel(block_id="comment-block", position={"x": 400, "y": 0})
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
graph.nodes = nodes
|
|
226
|
+
|
|
227
|
+
# Create links between nodes
|
|
228
|
+
for i in range(len(nodes) - 1):
|
|
229
|
+
graph.links.append(LinkModel(
|
|
230
|
+
source_id=nodes[i].id,
|
|
231
|
+
sink_id=nodes[i+1].id,
|
|
232
|
+
source_name="output",
|
|
233
|
+
sink_name="input"
|
|
234
|
+
))
|
|
235
|
+
|
|
236
|
+
return await graph.save()
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Production deployment
|
|
240
|
+
|
|
241
|
+
### Kubernetes deployment
|
|
242
|
+
|
|
243
|
+
```yaml
|
|
244
|
+
# autogpt-deployment.yaml
|
|
245
|
+
apiVersion: apps/v1
|
|
246
|
+
kind: Deployment
|
|
247
|
+
metadata:
|
|
248
|
+
name: autogpt-backend
|
|
249
|
+
spec:
|
|
250
|
+
replicas: 3
|
|
251
|
+
selector:
|
|
252
|
+
matchLabels:
|
|
253
|
+
app: autogpt-backend
|
|
254
|
+
template:
|
|
255
|
+
metadata:
|
|
256
|
+
labels:
|
|
257
|
+
app: autogpt-backend
|
|
258
|
+
spec:
|
|
259
|
+
containers:
|
|
260
|
+
- name: rest-server
|
|
261
|
+
image: autogpt/platform-backend:latest
|
|
262
|
+
command: ["poetry", "run", "rest"]
|
|
263
|
+
ports:
|
|
264
|
+
- containerPort: 8006
|
|
265
|
+
env:
|
|
266
|
+
- name: DATABASE_URL
|
|
267
|
+
valueFrom:
|
|
268
|
+
secretKeyRef:
|
|
269
|
+
name: autogpt-secrets
|
|
270
|
+
key: database-url
|
|
271
|
+
resources:
|
|
272
|
+
requests:
|
|
273
|
+
memory: "512Mi"
|
|
274
|
+
cpu: "500m"
|
|
275
|
+
limits:
|
|
276
|
+
memory: "2Gi"
|
|
277
|
+
cpu: "2000m"
|
|
278
|
+
---
|
|
279
|
+
apiVersion: apps/v1
|
|
280
|
+
kind: Deployment
|
|
281
|
+
metadata:
|
|
282
|
+
name: autogpt-executor
|
|
283
|
+
spec:
|
|
284
|
+
replicas: 5
|
|
285
|
+
selector:
|
|
286
|
+
matchLabels:
|
|
287
|
+
app: autogpt-executor
|
|
288
|
+
template:
|
|
289
|
+
spec:
|
|
290
|
+
containers:
|
|
291
|
+
- name: executor
|
|
292
|
+
image: autogpt/platform-backend:latest
|
|
293
|
+
command: ["poetry", "run", "executor"]
|
|
294
|
+
resources:
|
|
295
|
+
requests:
|
|
296
|
+
memory: "1Gi"
|
|
297
|
+
cpu: "1000m"
|
|
298
|
+
limits:
|
|
299
|
+
memory: "4Gi"
|
|
300
|
+
cpu: "4000m"
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Horizontal scaling
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
# autogpt-hpa.yaml
|
|
307
|
+
apiVersion: autoscaling/v2
|
|
308
|
+
kind: HorizontalPodAutoscaler
|
|
309
|
+
metadata:
|
|
310
|
+
name: autogpt-executor-hpa
|
|
311
|
+
spec:
|
|
312
|
+
scaleTargetRef:
|
|
313
|
+
apiVersion: apps/v1
|
|
314
|
+
kind: Deployment
|
|
315
|
+
name: autogpt-executor
|
|
316
|
+
minReplicas: 2
|
|
317
|
+
maxReplicas: 20
|
|
318
|
+
metrics:
|
|
319
|
+
- type: Resource
|
|
320
|
+
resource:
|
|
321
|
+
name: cpu
|
|
322
|
+
target:
|
|
323
|
+
type: Utilization
|
|
324
|
+
averageUtilization: 70
|
|
325
|
+
- type: External
|
|
326
|
+
external:
|
|
327
|
+
metric:
|
|
328
|
+
name: rabbitmq_queue_messages
|
|
329
|
+
selector:
|
|
330
|
+
matchLabels:
|
|
331
|
+
queue: graph-execution
|
|
332
|
+
target:
|
|
333
|
+
type: AverageValue
|
|
334
|
+
averageValue: 10
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Database optimization
|
|
338
|
+
|
|
339
|
+
```sql
|
|
340
|
+
-- Optimize for high-volume execution tracking
|
|
341
|
+
CREATE INDEX CONCURRENTLY idx_node_exec_graph_status
|
|
342
|
+
ON "AgentNodeExecution" ("graphExecutionId", "executionStatus");
|
|
343
|
+
|
|
344
|
+
CREATE INDEX CONCURRENTLY idx_graph_exec_user_status
|
|
345
|
+
ON "AgentGraphExecution" ("userId", "executionStatus", "createdAt" DESC);
|
|
346
|
+
|
|
347
|
+
-- Partition execution tables by date
|
|
348
|
+
CREATE TABLE "AgentGraphExecution_partitioned" (
|
|
349
|
+
LIKE "AgentGraphExecution" INCLUDING ALL
|
|
350
|
+
) PARTITION BY RANGE ("createdAt");
|
|
351
|
+
|
|
352
|
+
-- Create monthly partitions
|
|
353
|
+
CREATE TABLE "AgentGraphExecution_2024_01"
|
|
354
|
+
PARTITION OF "AgentGraphExecution_partitioned"
|
|
355
|
+
FOR VALUES FROM ('2024-01-01') TO ('2024-02-01');
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Monitoring and observability
|
|
359
|
+
|
|
360
|
+
### Prometheus metrics
|
|
361
|
+
|
|
362
|
+
```python
|
|
363
|
+
from prometheus_client import Counter, Histogram, Gauge
|
|
364
|
+
|
|
365
|
+
# Define metrics
|
|
366
|
+
EXECUTIONS_TOTAL = Counter(
|
|
367
|
+
'autogpt_executions_total',
|
|
368
|
+
'Total graph executions',
|
|
369
|
+
['graph_id', 'status']
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
EXECUTION_DURATION = Histogram(
|
|
373
|
+
'autogpt_execution_duration_seconds',
|
|
374
|
+
'Execution duration in seconds',
|
|
375
|
+
['graph_id'],
|
|
376
|
+
buckets=[0.1, 0.5, 1, 5, 10, 30, 60, 120]
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
ACTIVE_EXECUTIONS = Gauge(
|
|
380
|
+
'autogpt_active_executions',
|
|
381
|
+
'Currently running executions'
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
# Use in executor
|
|
385
|
+
class ExecutionManager:
|
|
386
|
+
async def execute_graph(self, graph_id, inputs):
|
|
387
|
+
ACTIVE_EXECUTIONS.inc()
|
|
388
|
+
start_time = time.time()
|
|
389
|
+
|
|
390
|
+
try:
|
|
391
|
+
result = await self._execute(graph_id, inputs)
|
|
392
|
+
EXECUTIONS_TOTAL.labels(graph_id=graph_id, status='success').inc()
|
|
393
|
+
return result
|
|
394
|
+
except Exception as e:
|
|
395
|
+
EXECUTIONS_TOTAL.labels(graph_id=graph_id, status='failed').inc()
|
|
396
|
+
raise
|
|
397
|
+
finally:
|
|
398
|
+
ACTIVE_EXECUTIONS.dec()
|
|
399
|
+
EXECUTION_DURATION.labels(graph_id=graph_id).observe(
|
|
400
|
+
time.time() - start_time
|
|
401
|
+
)
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Grafana dashboard
|
|
405
|
+
|
|
406
|
+
```json
|
|
407
|
+
{
|
|
408
|
+
"dashboard": {
|
|
409
|
+
"title": "AutoGPT Platform",
|
|
410
|
+
"panels": [
|
|
411
|
+
{
|
|
412
|
+
"title": "Executions per Minute",
|
|
413
|
+
"type": "graph",
|
|
414
|
+
"targets": [
|
|
415
|
+
{
|
|
416
|
+
"expr": "rate(autogpt_executions_total[1m])",
|
|
417
|
+
"legendFormat": "{{status}}"
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"title": "Execution Latency (p95)",
|
|
423
|
+
"type": "gauge",
|
|
424
|
+
"targets": [
|
|
425
|
+
{
|
|
426
|
+
"expr": "histogram_quantile(0.95, rate(autogpt_execution_duration_seconds_bucket[5m]))"
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"title": "Active Executions",
|
|
432
|
+
"type": "stat",
|
|
433
|
+
"targets": [
|
|
434
|
+
{"expr": "autogpt_active_executions"}
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Sentry error tracking
|
|
443
|
+
|
|
444
|
+
```python
|
|
445
|
+
import sentry_sdk
|
|
446
|
+
from sentry_sdk.integrations.fastapi import FastApiIntegration
|
|
447
|
+
from sentry_sdk.integrations.asyncio import AsyncioIntegration
|
|
448
|
+
|
|
449
|
+
sentry_sdk.init(
|
|
450
|
+
dsn=os.environ.get("SENTRY_DSN"),
|
|
451
|
+
integrations=[
|
|
452
|
+
FastApiIntegration(),
|
|
453
|
+
AsyncioIntegration(),
|
|
454
|
+
],
|
|
455
|
+
traces_sample_rate=0.1,
|
|
456
|
+
profiles_sample_rate=0.1,
|
|
457
|
+
environment=os.environ.get("APP_ENV", "development")
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
# Custom error context
|
|
461
|
+
with sentry_sdk.push_scope() as scope:
|
|
462
|
+
scope.set_tag("graph_id", graph_id)
|
|
463
|
+
scope.set_extra("inputs", sanitized_inputs)
|
|
464
|
+
sentry_sdk.capture_exception(error)
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
## API integration patterns
|
|
468
|
+
|
|
469
|
+
### Webhook handling
|
|
470
|
+
|
|
471
|
+
```python
|
|
472
|
+
from fastapi import APIRouter, Request
|
|
473
|
+
from backend.data.webhook import WebhookHandler
|
|
474
|
+
|
|
475
|
+
router = APIRouter()
|
|
476
|
+
|
|
477
|
+
@router.post("/webhooks/{webhook_id}")
|
|
478
|
+
async def handle_webhook(webhook_id: str, request: Request):
|
|
479
|
+
"""Handle incoming webhook."""
|
|
480
|
+
handler = WebhookHandler()
|
|
481
|
+
|
|
482
|
+
# Verify webhook signature
|
|
483
|
+
signature = request.headers.get("X-Webhook-Signature")
|
|
484
|
+
if not await handler.verify_signature(webhook_id, signature, await request.body()):
|
|
485
|
+
return {"error": "Invalid signature"}, 401
|
|
486
|
+
|
|
487
|
+
# Parse payload
|
|
488
|
+
payload = await request.json()
|
|
489
|
+
|
|
490
|
+
# Trigger associated graph
|
|
491
|
+
execution = await handler.trigger_graph(webhook_id, payload)
|
|
492
|
+
|
|
493
|
+
return {
|
|
494
|
+
"execution_id": execution.id,
|
|
495
|
+
"status": "queued"
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### External API rate limiting
|
|
500
|
+
|
|
501
|
+
```python
|
|
502
|
+
from asyncio import Semaphore
|
|
503
|
+
from functools import wraps
|
|
504
|
+
|
|
505
|
+
class RateLimiter:
|
|
506
|
+
"""Rate limiter for external API calls."""
|
|
507
|
+
|
|
508
|
+
def __init__(self, max_concurrent: int = 10, rate_per_second: float = 5):
|
|
509
|
+
self.semaphore = Semaphore(max_concurrent)
|
|
510
|
+
self.rate = rate_per_second
|
|
511
|
+
self.last_call = 0
|
|
512
|
+
|
|
513
|
+
async def acquire(self):
|
|
514
|
+
await self.semaphore.acquire()
|
|
515
|
+
now = time.time()
|
|
516
|
+
wait_time = max(0, (1 / self.rate) - (now - self.last_call))
|
|
517
|
+
if wait_time > 0:
|
|
518
|
+
await asyncio.sleep(wait_time)
|
|
519
|
+
self.last_call = time.time()
|
|
520
|
+
|
|
521
|
+
def release(self):
|
|
522
|
+
self.semaphore.release()
|
|
523
|
+
|
|
524
|
+
# Usage in block
|
|
525
|
+
class RateLimitedAPIBlock(Block):
|
|
526
|
+
rate_limiter = RateLimiter(max_concurrent=5, rate_per_second=2)
|
|
527
|
+
|
|
528
|
+
async def execute(self, input_data):
|
|
529
|
+
await self.rate_limiter.acquire()
|
|
530
|
+
try:
|
|
531
|
+
result = await self.call_api(input_data)
|
|
532
|
+
yield "output", result
|
|
533
|
+
finally:
|
|
534
|
+
self.rate_limiter.release()
|
|
535
|
+
```
|