Skip to main content

Software for aiding the best and multiplying the will - Core AI functionality and tracing

Project description

Synth AI

Comprehensive AI Framework for Language Models, Environments, and Observability

Python License PyPI Coverage ![Tests](https://img.shields.io/badge/tests-17/17 passing-brightgreen) A unified framework combining language model capabilities, synthetic environments, and comprehensive tracing for building and evaluating AI agents.

๐ŸŽฏ Key Features

  • ๐Ÿค– Language Models - Unified LM interface for OpenAI, Anthropic, Gemini, Groq, and more
  • ๐Ÿ—๏ธ Synthetic Environments - Comprehensive framework for agent training and evaluation
  • ๐Ÿ“Š Observability & Tracing - Built-in monitoring, logging, and performance tracking
  • ๐Ÿ”Œ Provider Support - Enhanced client wrappers with automatic tracing integration
  • ๐ŸŒ RESTful APIs - HTTP access for remote training and evaluation
  • ๐Ÿ› ๏ธ Agent Tools - Simple abstractions for agent-environment interaction

๐Ÿš€ Quick Start

Installation

# Basic installation
pip install synth-ai

# With research environments (includes game environments)
pip install synth-ai[research]

# Full installation with all providers
pip install synth-ai[all]

Basic Usage

from synth_ai import LM

# Create language model
lm = LM("gpt-4o-mini", temperature=0.7)

# Generate structured output
from pydantic import BaseModel

class Response(BaseModel):
    answer: str
    confidence: float

result = lm("What is the capital of France?", response_format=Response)
print(result.structured_output.answer)  # "Paris"

Environment Usage

from synth_ai.environments.examples.tictactoe.environment import TicTacToeEnvironment

# Create environment
env = TicTacToeEnvironment()

# Run agent
state = env.reset()
while not env.done:
    action = agent.act(state)
    state = env.step(action)

Tracing & Observability

from synth_ai.tracing import trace_event_sync

@trace_event_sync
def my_agent_step(observation):
    # Your agent logic here
    return action

# Automatic tracing of execution

๐ŸŽฎ Supported Environments

Environment Status Description
TicTacToe โœ… Stable Simple strategic game for testing
Sokoban โœ… Stable Classic puzzle game for planning
Hendryks Math โœ… Stable Mathematical reasoning tasks
Crafter ๐Ÿ”„ Research Minecraft-like survival environment
NetHack ๐Ÿ”„ Research Complex dungeon exploration
MiniGrid ๐Ÿ”„ Research Grid world navigation

๐Ÿค– Supported LM Providers

Provider Status Features
OpenAI โœ… Full GPT-4, structured outputs, tools
Anthropic โœ… Full Claude models, structured outputs
Google โœ… Full Gemini models, structured outputs
Groq โœ… Full Fast inference, structured outputs
Together โœ… Full Open source models
DeepSeek โœ… Full Code and reasoning models

๐Ÿ“– Documentation

๐Ÿ”ง Development

Health Check

# Check codebase health
python scripts/check_health.py

Testing

# Fast tests (~3 seconds)
uv run pytest tests/ -x --tb=short

# With research environments
uv run --extra research pytest tests/ 

# Full test suite with coverage
uv run pytest tests/ --cov=synth_ai --cov-report=html

Code Quality

# Format code
ruff format .

# Check linting
ruff check .

# Type checking
uvx ty check

# Run all checks
uvx ty check && ruff check . && ruff format --check .

Performance Profiling

# Profile LM inference
uv run python -m synth_ai.lm.core.profiler

# Profile environment execution  
uv run python -m synth_ai.environments.profiler

๐Ÿ“Š Test Coverage & Metrics

Run comprehensive tests and generate metrics:

# Generate test coverage report
uv run pytest tests/ --cov=synth_ai --cov-report=html --cov-report=term

# Update README metrics
python dev/update_readme_metrics.py

# Fast metric update (unit tests only)
python dev/update_readme_metrics.py --fast

๐Ÿ—๏ธ Architecture

Monorepo Structure

synth_ai/
โ”œโ”€โ”€ lm/                    # Language model core (formerly zyk)
โ”‚   โ”œโ”€โ”€ core/             # Main LM interface and clients
โ”‚   โ”œโ”€โ”€ vendors/          # Provider-specific implementations  
โ”‚   โ”œโ”€โ”€ provider_support/ # Enhanced client wrappers
โ”‚   โ””โ”€โ”€ structured_outputs/ # Structured generation
โ”œโ”€โ”€ environments/         # Environment framework (formerly synth_env)
โ”‚   โ”œโ”€โ”€ examples/         # Built-in environments
โ”‚   โ”œโ”€โ”€ service/          # REST API service
โ”‚   โ””โ”€โ”€ stateful/         # State management
โ”œโ”€โ”€ tracing/              # Observability (formerly synth_sdk)
โ”‚   โ”œโ”€โ”€ decorators/       # Function tracing
โ”‚   โ”œโ”€โ”€ events/           # Event management
โ”‚   โ””โ”€โ”€ upload/           # Remote logging
โ””โ”€โ”€ zyk/                  # Deprecated compatibility layer

Migration Guide

The package consolidates functionality from multiple repos:

# Old imports (deprecated, but still work)
from synth_ai.zyk import LM  # โš ๏ธ Shows deprecation warning
from synth_env import tasks  # โš ๏ธ Shows deprecation warning

# New imports (recommended)
from synth_ai import LM, environments
from synth_ai.environments import tasks
from synth_ai.lm.core.main import LM  # Direct import

๐Ÿšข Publishing & Releases

Build Package

# Build for PyPI
uv build

# Check package contents
tar -tzf dist/synth-ai-*.tar.gz | head -20

Publish

# Test on TestPyPI
uv publish --index-url https://test.pypi.org/legacy/

# Publish to PyPI
uv publish

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for:

  • Development setup with uv
  • Code style guidelines (ruff, uvx ty)
  • Testing requirements
  • Pull request process

Pre-Commit Checklist

# Run all checks before committing
uvx ty check && \
ruff check . && \
ruff format --check . && \
uv run pytest tests/ -x --tb=short

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Special thanks to the teams at OpenAI, Anthropic, Google, and other contributors to the AI ecosystem that made this framework possible.


โš ๏ธ Development Status: This is an active consolidation of multiple AI frameworks. While core LM and tracing functionality is production-ready, some environments may have breaking changes.

๐Ÿ“ˆ Recent Updates

  • v0.1.9: Consolidated monorepo with LM, environments, and tracing
  • Migration: Moved from synth_ai.zyk โ†’ synth_ai.lm with backward compatibility
  • Integration: Combined synth-sdk tracing and synth-env environments
  • Dependencies: Added optional [research] extras for heavy game environments

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synth_ai-0.2.1.dev0.tar.gz (477.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synth_ai-0.2.1.dev0-py3-none-any.whl (592.2 kB view details)

Uploaded Python 3

File details

Details for the file synth_ai-0.2.1.dev0.tar.gz.

File metadata

  • Download URL: synth_ai-0.2.1.dev0.tar.gz
  • Upload date:
  • Size: 477.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for synth_ai-0.2.1.dev0.tar.gz
Algorithm Hash digest
SHA256 ea1264348c14b0526538afa65259f5cd00099f468cf6774e3f26a5ac39bdacd2
MD5 f27e1ccf81832c6a0927032721178b11
BLAKE2b-256 6c6cbe362d169d5a637342b36b1701cbc0ea8d971ed8502c43ba6d75dcda5021

See more details on using hashes here.

File details

Details for the file synth_ai-0.2.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: synth_ai-0.2.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 592.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for synth_ai-0.2.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4add88c891dae9845377c9bd10d643ad553e1b316c84487cbc41cdcf8b3c9a6
MD5 ab707d76dd30b6004101c5da9e2c1c76
BLAKE2b-256 ed753f6046c6bed448fa9b1bfb5ae8189a7efd757d800794fab96970f828c70d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page