Repository navigation
Releases: zhangdw156/Sloop
Release list
v0.2.1
Sloop v0.2.1
This release introduces multithreaded dialog generation for significantly faster dataset creation, along with improved error handling and a refined logging system.
π New Features
Multithreaded Dialog Generation
- [cite_start]Concurrent Execution: Added the
--concurrency(alias-j) parameter to the CLI, allowing parallel generation of multiple dialog chains. - Quantity-Guaranteed Loop: Implemented a robust generation loop using the
wait(..., return_when=FIRST_COMPLETED)pattern. [cite_start]If a generation task fails (e.g., due to API errors), a replacement task is automatically spawned to ensure the requested count is exactly met. - [cite_start]Thread-Safe Sampling: Implemented global thread locks (
threading.Lock) for the graph sampling engine to ensure diverse starting nodes are selected without race conditions during parallel execution.
π‘οΈ Stability & Improvements
Smart Error Handling
- Context Window Fallback: Added a smart retry mechanism for
litellm.ContextWindowExceededError. [cite_start]If a prompt exceeds the token limit, the engine automatically retries the generation with a reducedrag_top_kvalue (halving the number of RAG examples). - [cite_start]Hallucination Prevention: hardened agent prompts (specifically in
assistant_decideandselectortemplates) with strict prohibitions against inventing tools or parameters not defined in the schema.
Logging & Developer Experience
- Separated Logging Streams:
- [cite_start]Console: Now uses
tqdm_sinkto display onlyWARNINGandERRORlogs, ensuring the progress bar remains clean and visual artifacts are minimized. - [cite_start]File Log: Detailed
DEBUGandINFOlogs are written tologs/sloop.log, now including thread names to assist in debugging concurrent processes.
- [cite_start]Console: Now uses
- [cite_start]Reduced Noise: Suppressed verbose debug output from
LiteLLMto keep the console output focused.
β‘ Usage
Generate 100 dialogs using 4 concurrent threads:
sloop generate --count 100 --concurrency 4v0.2.0
π Sloop v0.2.0: The "Intelligent Sampling" Update
Sloop v0.2.0 represents a major leap forward from random graph walks to intelligent, intent-driven dialogue generation. This release introduces a RAG-Enhanced Sampling Engine that combines the explicit structure of tool graphs with the semantic power of vector retrieval, orchestrated by an LLM-based decision agent.
β¨ New Features
π§ RAG-Enhanced Sampling (--mode rag)
The new hybrid sampling mode allows Sloop to find semantically related tools even when no direct edge exists in the graph.
- Vector Retrieval: Powered by FAISS and LiteLLM, Sloop now indexes your tool definitions locally.
- Semantic Associations: Capable of "hallucinating" logical next steps based on tool descriptions (e.g., associating "booking a flight" with "checking weather").
- Persistent Caching: Vector indexes are cached in
.cache/for ultra-fast startup times.
π¨ββοΈ LLM Selector Agent
We have replaced random selection in RAG mode with a smart Selector Agent.
- Context-Aware Decision: The agent analyzes the current conversation history and candidate tools to pick the most logical next action.
- Smart Termination: The agent autonomously decides when a task is complete and returns
FINISH.
π Global Diversity Strategy
To prevent "Mode Collapse" (where the model repeatedly samples the same popular tools), we implemented a Global Coverage Sampling strategy. This forces the generator to explore the entire spectrum of available tools before repeating start nodes.
π οΈ Improvements & Refactoring
- Standardized Configuration: Refactored
config.pyto explicitly separate Providers and Models.- New variables:
LLM_PROVIDER,LLM_MODEL,EMBEDDING_PROVIDER,EMBEDDING_MODEL. - Backward Compatibility: Your existing
.envfiles usingMODEL_NAMEwill still work seamlessly.
- New variables:
- New Dependencies: Added
faiss-cpuandnumpyfor efficient vector operations.
π¦ How to Use
Generate synthetic data using the new intelligent mode:
# Standard RAG mode (Recommended for high-quality data)
sloop generate --mode rag --count 100
# Legacy random walk mode
sloop generate --mode graph --count 100βοΈ Configuration Update
While not required (due to backward compatibility), we recommend updating your .env to utilize the new configuration structure, especially if using local embedding models:
# Chat Model Configuration
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o-mini
# Embedding Configuration (New)
EMBEDDING_PROVIDER=openai
EMBEDDING_MODEL=text-embedding-3-small
# Or for local use:
# EMBEDDING_PROVIDER=ollama
# EMBEDDING_MODEL=nomic-embed-textv0.1.2
Release v0.1.2: High-Quality Tool-Use Data Synthesis Framework π
We are thrilled to introduce Sloop, an advanced synthetic data generation framework designed to produce high-quality, reasoning-intensive tool-use datasets for training Large Language Models (LLMs).
Unlike traditional random generation methods, Sloop introduces a Graph-Based Intelligent Synthesis Strategy to ensure logical coherence and domain relevance in multi-turn dialogues.
π§ Core Mechanism: Intelligent Tool Chain Generation
Sloop abandons completely random tool combinations in favor of a sophisticated graph-theoretic approach to generate realistic user tasks.
1. Automated Dependency Inference (Graph Construction) π
Sloop automatically analyzes your tool definitions (OpenAI schema) to build a massive Tool Dependency Graph.
- Logic: It infers dependencies by matching "upstream outputs" with "downstream inputs."
- Mechanism: If the required parameter of Tool B (e.g.,
dish_id) appears in the description of Tool A (e.g., "returns a list of dishes withdish_id"), Sloop establishes a directed edgeA -> B. - Result: This creates a structured map of how tools can naturally interact, ensuring that generated workflows are technically viable.
2. Domain-Sticky Sampling (Sticky Random Walk) π§
To generate multi-step tasks, Sloop employs a "Sticky Random Walk" algorithm on the dependency graph.
- Domain Stickiness: The algorithm prefers staying within the same or related domains (e.g.,
Travel->Hotel->Payment) rather than making illogical jumps (e.g.,Weather->Stock Market). - Scoring System:
- Strong Relation (1.0): Tools within the same category.
- Weak Relation (0.7): Tools in logically related categories (e.g., Music & Audio).
- No Relation (0.3): Unrelated domains.
- Probabilistic Selection: The system selects the next tool based on these scores (80% probability for the best logical fit, 20% for diversity), simulating real-world user behavior that is purposeful yet occasionally non-linear.
3. PDA-Driven Execution π€
Once a logical tool chain is sampled, Sloop's Pushdown Automaton (PDA) engine orchestrates a multi-agent simulation (User, Assistant, Service) to generate the actual dialogue, complete with Chain-of-Thought (CoT) reasoning and stateful environment updates.
β¨ Key Features
- π¦ Training-Ready: Outputs data in a flat JSON format ready for SFT (Supervised Fine-Tuning) or RLHF.
- π§ Stateful Simulation: Maintains a virtual environment state to prevent hallucinations and ensure data consistency.
- β‘ Scalable: Capable of handling thousands of tool definitions efficiently.
Build the next generation of reasoning-capable Agent models with Sloop.
v0.1.1
Release v0.1.1
This is a minor release that includes several improvements and bug fixes.
Features
- Added gorilla BFCL recipes and configurations
- Integrated loguru for enhanced logging capabilities
- Removed mock LLM implementation in favor of real integrations
Fixes
- Updated logger configuration for better console output compatibility with tqdm
- Resolved 7 code quality issues identified by ruff linting
Maintenance
- Applied ruff formatting and linting across the codebase
- Improved overall code quality and consistency
Installation
pip install sloop==0.1.1For more information, please visit the project repository.