@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,548 @@
|
|
|
1
|
+
# LangSmith Advanced Usage Guide
|
|
2
|
+
|
|
3
|
+
## Custom Evaluators
|
|
4
|
+
|
|
5
|
+
### Simple Custom Evaluator
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from langsmith import evaluate
|
|
9
|
+
|
|
10
|
+
def accuracy_evaluator(run, example):
|
|
11
|
+
"""Check if prediction matches reference."""
|
|
12
|
+
prediction = run.outputs.get("answer", "")
|
|
13
|
+
reference = example.outputs.get("answer", "")
|
|
14
|
+
|
|
15
|
+
score = 1.0 if prediction.strip().lower() == reference.strip().lower() else 0.0
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
"key": "accuracy",
|
|
19
|
+
"score": score,
|
|
20
|
+
"comment": f"Predicted: {prediction[:50]}..."
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
results = evaluate(
|
|
24
|
+
my_model,
|
|
25
|
+
data="test-dataset",
|
|
26
|
+
evaluators=[accuracy_evaluator]
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### LLM-as-Judge Evaluator
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from langsmith import evaluate
|
|
34
|
+
from openai import OpenAI
|
|
35
|
+
|
|
36
|
+
client = OpenAI()
|
|
37
|
+
|
|
38
|
+
def llm_judge_evaluator(run, example):
|
|
39
|
+
"""Use LLM to evaluate response quality."""
|
|
40
|
+
prediction = run.outputs.get("answer", "")
|
|
41
|
+
question = example.inputs.get("question", "")
|
|
42
|
+
reference = example.outputs.get("answer", "")
|
|
43
|
+
|
|
44
|
+
prompt = f"""Evaluate the following response for accuracy and helpfulness.
|
|
45
|
+
|
|
46
|
+
Question: {question}
|
|
47
|
+
Reference Answer: {reference}
|
|
48
|
+
Model Response: {prediction}
|
|
49
|
+
|
|
50
|
+
Rate on a scale of 1-5:
|
|
51
|
+
1 = Completely wrong
|
|
52
|
+
5 = Perfect answer
|
|
53
|
+
|
|
54
|
+
Respond with just the number."""
|
|
55
|
+
|
|
56
|
+
response = client.chat.completions.create(
|
|
57
|
+
model="gpt-4o",
|
|
58
|
+
messages=[{"role": "user", "content": prompt}],
|
|
59
|
+
max_tokens=10
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
score = int(response.choices[0].message.content.strip()) / 5.0
|
|
64
|
+
except ValueError:
|
|
65
|
+
score = 0.5
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
"key": "llm_judge",
|
|
69
|
+
"score": score,
|
|
70
|
+
"comment": response.choices[0].message.content
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
results = evaluate(
|
|
74
|
+
my_model,
|
|
75
|
+
data="test-dataset",
|
|
76
|
+
evaluators=[llm_judge_evaluator]
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Async Evaluator
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from langsmith import aevaluate
|
|
84
|
+
import asyncio
|
|
85
|
+
|
|
86
|
+
async def async_evaluator(run, example):
|
|
87
|
+
"""Async evaluator for concurrent evaluation."""
|
|
88
|
+
prediction = run.outputs.get("answer", "")
|
|
89
|
+
|
|
90
|
+
# Async operation (e.g., API call)
|
|
91
|
+
score = await compute_similarity_async(prediction, example.outputs["answer"])
|
|
92
|
+
|
|
93
|
+
return {"key": "similarity", "score": score}
|
|
94
|
+
|
|
95
|
+
async def run_async_eval():
|
|
96
|
+
results = await aevaluate(
|
|
97
|
+
async_model,
|
|
98
|
+
data="test-dataset",
|
|
99
|
+
evaluators=[async_evaluator],
|
|
100
|
+
max_concurrency=10
|
|
101
|
+
)
|
|
102
|
+
return results
|
|
103
|
+
|
|
104
|
+
results = asyncio.run(run_async_eval())
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Multiple Return Values
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
def comprehensive_evaluator(run, example):
|
|
111
|
+
"""Return multiple evaluation results."""
|
|
112
|
+
prediction = run.outputs.get("answer", "")
|
|
113
|
+
reference = example.outputs.get("answer", "")
|
|
114
|
+
|
|
115
|
+
return [
|
|
116
|
+
{"key": "exact_match", "score": 1.0 if prediction == reference else 0.0},
|
|
117
|
+
{"key": "length_ratio", "score": min(len(prediction) / max(len(reference), 1), 1.0)},
|
|
118
|
+
{"key": "contains_reference", "score": 1.0 if reference.lower() in prediction.lower() else 0.0}
|
|
119
|
+
]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Summary Evaluators
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
def summary_evaluator(runs, examples):
|
|
126
|
+
"""Compute aggregate metrics across all runs."""
|
|
127
|
+
total_latency = sum(
|
|
128
|
+
(run.end_time - run.start_time).total_seconds()
|
|
129
|
+
for run in runs if run.end_time and run.start_time
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
avg_latency = total_latency / len(runs) if runs else 0
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
"key": "avg_latency",
|
|
136
|
+
"score": avg_latency
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
results = evaluate(
|
|
140
|
+
my_model,
|
|
141
|
+
data="test-dataset",
|
|
142
|
+
evaluators=[accuracy_evaluator],
|
|
143
|
+
summary_evaluators=[summary_evaluator]
|
|
144
|
+
)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Comparative Evaluation
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from langsmith import evaluate_comparative
|
|
151
|
+
|
|
152
|
+
def pairwise_judge(runs, example):
|
|
153
|
+
"""Compare two model outputs."""
|
|
154
|
+
output_a = runs[0].outputs.get("answer", "")
|
|
155
|
+
output_b = runs[1].outputs.get("answer", "")
|
|
156
|
+
reference = example.outputs.get("answer", "")
|
|
157
|
+
|
|
158
|
+
# Use LLM to compare
|
|
159
|
+
prompt = f"""Compare these two answers to the question.
|
|
160
|
+
|
|
161
|
+
Question: {example.inputs['question']}
|
|
162
|
+
Reference: {reference}
|
|
163
|
+
|
|
164
|
+
Answer A: {output_a}
|
|
165
|
+
Answer B: {output_b}
|
|
166
|
+
|
|
167
|
+
Which is better? Respond with 'A', 'B', or 'TIE'."""
|
|
168
|
+
|
|
169
|
+
response = llm.invoke(prompt)
|
|
170
|
+
|
|
171
|
+
if "A" in response:
|
|
172
|
+
return {"key": "preference", "scores": {"model_a": 1.0, "model_b": 0.0}}
|
|
173
|
+
elif "B" in response:
|
|
174
|
+
return {"key": "preference", "scores": {"model_a": 0.0, "model_b": 1.0}}
|
|
175
|
+
else:
|
|
176
|
+
return {"key": "preference", "scores": {"model_a": 0.5, "model_b": 0.5}}
|
|
177
|
+
|
|
178
|
+
results = evaluate_comparative(
|
|
179
|
+
["experiment-a-id", "experiment-b-id"],
|
|
180
|
+
evaluators=[pairwise_judge]
|
|
181
|
+
)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Advanced Tracing
|
|
185
|
+
|
|
186
|
+
### Run Trees
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from langsmith import RunTree
|
|
190
|
+
|
|
191
|
+
# Create root run
|
|
192
|
+
root = RunTree(
|
|
193
|
+
name="complex_pipeline",
|
|
194
|
+
run_type="chain",
|
|
195
|
+
inputs={"query": "What is AI?"},
|
|
196
|
+
project_name="my-project"
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
# Create child run
|
|
200
|
+
child = root.create_child(
|
|
201
|
+
name="retrieval_step",
|
|
202
|
+
run_type="retriever",
|
|
203
|
+
inputs={"query": "What is AI?"}
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
# Execute and record
|
|
207
|
+
docs = retriever.invoke("What is AI?")
|
|
208
|
+
child.end(outputs={"documents": docs})
|
|
209
|
+
|
|
210
|
+
# Another child
|
|
211
|
+
llm_child = root.create_child(
|
|
212
|
+
name="llm_call",
|
|
213
|
+
run_type="llm",
|
|
214
|
+
inputs={"prompt": f"Context: {docs}\n\nQuestion: What is AI?"}
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
response = llm.invoke(...)
|
|
218
|
+
llm_child.end(outputs={"response": response})
|
|
219
|
+
|
|
220
|
+
# End root
|
|
221
|
+
root.end(outputs={"answer": response})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Distributed Tracing
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from langsmith import get_current_run_tree
|
|
228
|
+
from langsmith.run_helpers import get_tracing_context
|
|
229
|
+
|
|
230
|
+
# Get current trace context
|
|
231
|
+
context = get_tracing_context()
|
|
232
|
+
run_tree = get_current_run_tree()
|
|
233
|
+
|
|
234
|
+
# Pass to another service
|
|
235
|
+
trace_headers = {
|
|
236
|
+
"langsmith-trace": run_tree.trace_id,
|
|
237
|
+
"langsmith-parent": run_tree.id
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
# In receiving service
|
|
241
|
+
from langsmith import RunTree
|
|
242
|
+
|
|
243
|
+
child_run = RunTree(
|
|
244
|
+
name="remote_operation",
|
|
245
|
+
run_type="tool",
|
|
246
|
+
parent_run_id=headers["langsmith-parent"],
|
|
247
|
+
trace_id=headers["langsmith-trace"]
|
|
248
|
+
)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Attachments
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
from langsmith import Client
|
|
255
|
+
|
|
256
|
+
client = Client()
|
|
257
|
+
|
|
258
|
+
# Attach files to examples
|
|
259
|
+
client.create_example(
|
|
260
|
+
inputs={"query": "Describe this image"},
|
|
261
|
+
outputs={"description": "A sunset over mountains"},
|
|
262
|
+
attachments={
|
|
263
|
+
"image": ("image/jpeg", image_bytes)
|
|
264
|
+
},
|
|
265
|
+
dataset_id=dataset.id
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
# Attach to runs
|
|
269
|
+
from langsmith import traceable
|
|
270
|
+
|
|
271
|
+
@traceable(dangerously_allow_filesystem=True)
|
|
272
|
+
def process_file(file_path: str):
|
|
273
|
+
with open(file_path, "rb") as f:
|
|
274
|
+
return {"result": analyze(f.read())}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Hub Prompts
|
|
278
|
+
|
|
279
|
+
### Pull and Use Prompts
|
|
280
|
+
|
|
281
|
+
```python
|
|
282
|
+
from langsmith import Client
|
|
283
|
+
|
|
284
|
+
client = Client()
|
|
285
|
+
|
|
286
|
+
# Pull prompt from hub
|
|
287
|
+
prompt = client.pull_prompt("langchain-ai/rag-prompt")
|
|
288
|
+
|
|
289
|
+
# Use prompt
|
|
290
|
+
response = prompt.invoke({
|
|
291
|
+
"context": "Python is a programming language...",
|
|
292
|
+
"question": "What is Python?"
|
|
293
|
+
})
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Push Prompts
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
from langchain_core.prompts import ChatPromptTemplate
|
|
300
|
+
|
|
301
|
+
# Create prompt
|
|
302
|
+
prompt = ChatPromptTemplate.from_messages([
|
|
303
|
+
("system", "You are a helpful {role}."),
|
|
304
|
+
("user", "{question}")
|
|
305
|
+
])
|
|
306
|
+
|
|
307
|
+
# Push to hub
|
|
308
|
+
client.push_prompt("my-org/my-prompt", object=prompt)
|
|
309
|
+
|
|
310
|
+
# Push with tags
|
|
311
|
+
client.push_prompt(
|
|
312
|
+
"my-org/my-prompt",
|
|
313
|
+
object=prompt,
|
|
314
|
+
tags=["production", "v2"]
|
|
315
|
+
)
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Versioned Prompts
|
|
319
|
+
|
|
320
|
+
```python
|
|
321
|
+
# Pull specific version
|
|
322
|
+
prompt_v1 = client.pull_prompt("my-org/my-prompt", commit_hash="abc123")
|
|
323
|
+
|
|
324
|
+
# Pull latest
|
|
325
|
+
prompt_latest = client.pull_prompt("my-org/my-prompt")
|
|
326
|
+
|
|
327
|
+
# Compare versions
|
|
328
|
+
print(f"V1 template: {prompt_v1}")
|
|
329
|
+
print(f"Latest template: {prompt_latest}")
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Dataset Management
|
|
333
|
+
|
|
334
|
+
### Create from Runs
|
|
335
|
+
|
|
336
|
+
```python
|
|
337
|
+
from langsmith import Client
|
|
338
|
+
|
|
339
|
+
client = Client()
|
|
340
|
+
|
|
341
|
+
# Create dataset from existing runs
|
|
342
|
+
runs = client.list_runs(
|
|
343
|
+
project_name="production",
|
|
344
|
+
filter='and(eq(feedback_key, "user_rating"), gt(feedback_score, 0.8))'
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
# Convert to examples
|
|
348
|
+
examples = []
|
|
349
|
+
for run in runs:
|
|
350
|
+
examples.append({
|
|
351
|
+
"inputs": run.inputs,
|
|
352
|
+
"outputs": run.outputs
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
# Create dataset
|
|
356
|
+
dataset = client.create_dataset("high-quality-examples")
|
|
357
|
+
client.create_examples(
|
|
358
|
+
inputs=[e["inputs"] for e in examples],
|
|
359
|
+
outputs=[e["outputs"] for e in examples],
|
|
360
|
+
dataset_id=dataset.id
|
|
361
|
+
)
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Dataset Splits
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
from langsmith import Client
|
|
368
|
+
import random
|
|
369
|
+
|
|
370
|
+
client = Client()
|
|
371
|
+
|
|
372
|
+
# Get all examples
|
|
373
|
+
examples = list(client.list_examples(dataset_name="my-dataset"))
|
|
374
|
+
random.shuffle(examples)
|
|
375
|
+
|
|
376
|
+
# Split
|
|
377
|
+
train_size = int(0.8 * len(examples))
|
|
378
|
+
train_examples = examples[:train_size]
|
|
379
|
+
test_examples = examples[train_size:]
|
|
380
|
+
|
|
381
|
+
# Create split datasets
|
|
382
|
+
train_dataset = client.create_dataset("my-dataset-train")
|
|
383
|
+
test_dataset = client.create_dataset("my-dataset-test")
|
|
384
|
+
|
|
385
|
+
for ex in train_examples:
|
|
386
|
+
client.create_example(inputs=ex.inputs, outputs=ex.outputs, dataset_id=train_dataset.id)
|
|
387
|
+
|
|
388
|
+
for ex in test_examples:
|
|
389
|
+
client.create_example(inputs=ex.inputs, outputs=ex.outputs, dataset_id=test_dataset.id)
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Upload from CSV
|
|
393
|
+
|
|
394
|
+
```python
|
|
395
|
+
from langsmith import Client
|
|
396
|
+
|
|
397
|
+
client = Client()
|
|
398
|
+
|
|
399
|
+
# Upload CSV directly
|
|
400
|
+
dataset = client.upload_csv(
|
|
401
|
+
csv_file="./qa_data.csv",
|
|
402
|
+
input_keys=["question"],
|
|
403
|
+
output_keys=["answer"],
|
|
404
|
+
name="qa-dataset",
|
|
405
|
+
description="QA pairs from CSV"
|
|
406
|
+
)
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Filtering and Querying
|
|
410
|
+
|
|
411
|
+
### Run Filters
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
from langsmith import Client
|
|
415
|
+
|
|
416
|
+
client = Client()
|
|
417
|
+
|
|
418
|
+
# Complex filters
|
|
419
|
+
runs = client.list_runs(
|
|
420
|
+
project_name="production",
|
|
421
|
+
filter='and(eq(status, "success"), gt(latency, 2.0))',
|
|
422
|
+
execution_order=1, # Only root runs
|
|
423
|
+
start_time="2024-01-01T00:00:00Z",
|
|
424
|
+
end_time="2024-12-31T23:59:59Z"
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
# Filter by tags
|
|
428
|
+
runs = client.list_runs(
|
|
429
|
+
project_name="production",
|
|
430
|
+
filter='has(tags, "production")'
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
# Filter by error
|
|
434
|
+
runs = client.list_runs(
|
|
435
|
+
project_name="production",
|
|
436
|
+
filter='eq(status, "error")'
|
|
437
|
+
)
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Feedback Queries
|
|
441
|
+
|
|
442
|
+
```python
|
|
443
|
+
# Get runs with specific feedback
|
|
444
|
+
runs = client.list_runs(
|
|
445
|
+
project_name="production",
|
|
446
|
+
filter='and(eq(feedback_key, "user_rating"), lt(feedback_score, 0.5))'
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
# Aggregate feedback
|
|
450
|
+
from collections import defaultdict
|
|
451
|
+
|
|
452
|
+
feedback_by_key = defaultdict(list)
|
|
453
|
+
for feedback in client.list_feedback(project_name="production"):
|
|
454
|
+
feedback_by_key[feedback.key].append(feedback.score)
|
|
455
|
+
|
|
456
|
+
for key, scores in feedback_by_key.items():
|
|
457
|
+
print(f"{key}: avg={sum(scores)/len(scores):.2f}, count={len(scores)}")
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## OpenTelemetry Integration
|
|
461
|
+
|
|
462
|
+
```python
|
|
463
|
+
from opentelemetry import trace
|
|
464
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
465
|
+
from langsmith import Client
|
|
466
|
+
|
|
467
|
+
# Set up OTel
|
|
468
|
+
provider = TracerProvider()
|
|
469
|
+
trace.set_tracer_provider(provider)
|
|
470
|
+
|
|
471
|
+
# Create client with OTel integration
|
|
472
|
+
client = Client(otel_tracer_provider=provider)
|
|
473
|
+
|
|
474
|
+
# Traces will be exported to both LangSmith and OTel backends
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## Multi-Tenant Setup
|
|
478
|
+
|
|
479
|
+
```python
|
|
480
|
+
from langsmith import Client
|
|
481
|
+
|
|
482
|
+
# Configure multiple endpoints
|
|
483
|
+
api_urls = {
|
|
484
|
+
"https://api-team1.langsmith.com": "api_key_1",
|
|
485
|
+
"https://api-team2.langsmith.com": "api_key_2"
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
# Client writes to all endpoints
|
|
489
|
+
client = Client(api_urls=api_urls)
|
|
490
|
+
|
|
491
|
+
# All operations replicated
|
|
492
|
+
client.create_run(
|
|
493
|
+
name="shared_operation",
|
|
494
|
+
run_type="chain",
|
|
495
|
+
inputs={"query": "test"}
|
|
496
|
+
)
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
## Batch Operations
|
|
500
|
+
|
|
501
|
+
```python
|
|
502
|
+
from langsmith import Client
|
|
503
|
+
|
|
504
|
+
client = Client()
|
|
505
|
+
|
|
506
|
+
# Batch create examples
|
|
507
|
+
inputs = [{"q": f"Question {i}"} for i in range(1000)]
|
|
508
|
+
outputs = [{"a": f"Answer {i}"} for i in range(1000)]
|
|
509
|
+
|
|
510
|
+
client.create_examples(
|
|
511
|
+
inputs=inputs,
|
|
512
|
+
outputs=outputs,
|
|
513
|
+
dataset_id=dataset.id
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
# Batch update examples
|
|
517
|
+
example_ids = [ex.id for ex in client.list_examples(dataset_id=dataset.id)]
|
|
518
|
+
client.update_examples(
|
|
519
|
+
example_ids=example_ids,
|
|
520
|
+
metadata=[{"updated": True} for _ in example_ids]
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
# Batch delete
|
|
524
|
+
client.delete_examples(example_ids=example_ids[:100])
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
## Caching and Performance
|
|
528
|
+
|
|
529
|
+
```python
|
|
530
|
+
from langsmith import Client
|
|
531
|
+
from functools import lru_cache
|
|
532
|
+
|
|
533
|
+
client = Client()
|
|
534
|
+
|
|
535
|
+
# Cache dataset lookups
|
|
536
|
+
@lru_cache(maxsize=100)
|
|
537
|
+
def get_dataset_id(name: str) -> str:
|
|
538
|
+
dataset = client.read_dataset(dataset_name=name)
|
|
539
|
+
return str(dataset.id)
|
|
540
|
+
|
|
541
|
+
# Batch tracing for high throughput
|
|
542
|
+
client = Client(auto_batch_tracing=True)
|
|
543
|
+
|
|
544
|
+
# Control batch size
|
|
545
|
+
import os
|
|
546
|
+
os.environ["LANGSMITH_BATCH_SIZE"] = "100"
|
|
547
|
+
os.environ["LANGSMITH_BATCH_INTERVAL_MS"] = "1000"
|
|
548
|
+
```
|