Skip to content

v0.2.0 — Developer Experience Release

Latest

Choose a tag to compare

@apartsin apartsin released this 11 Mar 08:53
· 15 commits to master since this release

What's New in v0.2.0

This release focuses on developer experience — making ModelMesh easier to adopt, test, debug, and extend. All features ship with full Python + TypeScript parity.

7 New Features

1. Structured Exception Hierarchy

Catch specific error types instead of bare RuntimeError:

from modelmesh.exceptions import RateLimitError, BudgetExceededError

try:
    response = client.chat.completions.create(...)
except RateLimitError as e:
    print(f"Retry in {e.retry_after}s")
except BudgetExceededError as e:
    print(f"{e.limit_type} limit: ${e.limit_value}")

2. Request/Response Middleware

Intercept every request for logging, transforms, or custom headers:

from modelmesh import Middleware

class LoggingMiddleware(Middleware):
    async def before_request(self, request, context):
        print(f"-> {context.model_id}")
        return request
    async def after_response(self, response, context):
        print(f"<- {response.usage.total_tokens} tokens")
        return response

3. Context Manager Support

Clean resource cleanup with with/async with (Python) or close() (TypeScript):

async with modelmesh.create("chat") as client:
    response = await client.chat.completions.create(...)
# Automatic cleanup

4. Usage Tracking API

Monitor costs and tokens across models and providers:

print(client.usage.total_cost)
print(client.usage.by_model)

5. Mock Testing Client

Test without live APIs — pre-configured responses with call recording:

from modelmesh.testing import mock_client, MockResponse
client = mock_client(responses=[MockResponse(content="Hello!", tokens=10)])

6. Capability Discovery

Explore available capabilities without memorizing paths:

modelmesh.capabilities.resolve("chat-completion")
# -> 'generation.text-generation.chat-completion'
modelmesh.capabilities.search("text")
# -> ['text-embeddings', 'text-generation', ...]

7. Routing Explanation

Debug why a model was selected without making API calls:

explanation = client.explain(model="chat")
print(explanation.selected_model, explanation.reason)

Audit & Quality

  • 50+ code-docs-tests inconsistencies fixed
  • Cross-language parity audit: matching method signatures, parameters, return types
  • All new features backward-compatible — existing code works unchanged

Testing

  • 1,879 tests passing (1,166 Python + 713 TypeScript)
  • 63 new Python DX tests + 69 new TypeScript DX tests

Samples & Documentation

  • 12 new quickstart samples (06-11 for Python and TypeScript)
  • 5 new developer guides: QuickStart, Error Handling, Middleware, Testing, Capabilities
  • Updated docs index with new features and navigation

Install

# Python
pip install modelmesh-lite==0.2.0

# TypeScript
npm install @nistrapa/modelmesh-core@0.2.0

TypeScript Sub-path Imports

New deep imports for tree-shaking:

import { mockClient } from '@nistrapa/modelmesh-core/testing';
import { resolve } from '@nistrapa/modelmesh-core/capabilities';
import { Middleware } from '@nistrapa/modelmesh-core/middleware';

Full Changelog: v0.1.1...v0.2.0