From 0a9d672521e5224ad2560fd029344ee4c1d2cb6c Mon Sep 17 00:00:00 2001 From: Daniil Yarmalkevich Date: Thu, 16 Apr 2026 13:15:12 +0300 Subject: [PATCH 1/2] feat: add config for Claude Code --- .claude/settings.json | 18 ++++++++++++ CLAUDE.md | 67 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .claude/settings.json create mode 100644 CLAUDE.md diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..9961615 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,18 @@ +{ + "permissions": { + "allow": [ + "Bash(make format:*)", + "Bash(make lint:*)", + "Bash(make mypy:*)", + "Bash(make test:*)" + ], + "deny": [ + "Read(**/*.env)" + ], + "ask": [] + }, + "enabledPlugins": { + "pyright-lsp@claude-plugins-official": true, + "claude-md-management@claude-plugins-official": true + } +} diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..12fc306 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,67 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Python client library for the AI DIAL platform API (`aidial-client` on PyPI). Provides both sync (`Dial`) and async (`AsyncDial`) clients with typed Pydantic models. Supports Python 3.10-3.13. + +## Useful Resources + +- OpenAPI specification for the DIAL platform API https://dialx.ai/universal_chat_api.yaml +- DIAL Core GitHub repository: https://github.com/epam/ai-dial-core +- DIAL platform documentation: https://github.com/epam/ai-dial + +## Common Commands + +```bash +# Setup +make install # Install dependencies via Poetry + +# Testing +make test # Run unit tests across Python 3.10-3.13 via nox +make test PYTHON=3.12 # Run tests for a specific Python version +make integration_test # Run integration tests (requires real API) +make coverage # Run tests with coverage report + +# Run a single test directly +poetry run pytest tests/test_auth.py -k "test_name" + +# Linting & formatting +make lint # Run all linters (pyright, flake8, codespell, format check) +make format # Auto-format code (autoflake, isort, black) +``` + +## Dependency Compatibility Matrix + +Tests run against a matrix of dependency versions via nox parametrize (see `noxfile.py`). + +All code must work across these versions. The `aidial_client/_compatibility/` module handles Pydantic v1/v2 and OpenAI v1/v2 differences. + +## Architecture + +### Sync/Async Dual API Pattern + +Every public API has both sync and async variants built on a generic base: + +- `BaseDialClient[HttpClientT, AuthValueT]` -> `Dial` (sync) / `AsyncDial` (async) +- `BaseResource` / `AsyncResource` for API resource classes +- `SyncHTTPClient` / `AsyncHTTPClient` wrapping httpx + +### Key Modules + +- `_client.py` - Core client classes +- `_client_pool.py` - Connection pooling (`DialClientPool` / `AsyncDialClientPool`) +- `_auth.py` - Auth handling (API key, Bearer token, callable auth) +- `_http_client/` - HTTP transport layer (sync/async) +- `_exception.py` - Custom exception hierarchy rooted at `DialException` +- `types/` - Pydantic models for all API request/response types +- `resources/` - API resource handler classes +- `_compatibility/` - Pydantic v1/v2 and OpenAI v1/v2 compatibility shims + +## PR Checklist + +When adding or modifying public API (new resources, methods, types): +- Update `README.md` with usage examples (sync + async) and sample response objects +- Add the new resource to the Client Structure list above +- Export new classes from `resources/__init__.py` From c4ba6ea220e46b9c6510942a8f311e086aea4016 Mon Sep 17 00:00:00 2001 From: Daniil Yarmalkevich Date: Thu, 16 Apr 2026 15:07:25 +0300 Subject: [PATCH 2/2] fix: remove non-existent make mypy permission Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.claude/settings.json b/.claude/settings.json index 9961615..2f6db7d 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -3,7 +3,6 @@ "allow": [ "Bash(make format:*)", "Bash(make lint:*)", - "Bash(make mypy:*)", "Bash(make test:*)" ], "deny": [