kitkat 0.1.0__tar.gz

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.
Files changed (54) hide show
  1. kitkat-0.1.0/.github/images/logo-dark.jpg +0 -0
  2. kitkat-0.1.0/.github/images/logo-light.jpg +0 -0
  3. kitkat-0.1.0/.github/workflows/publish.yml +23 -0
  4. kitkat-0.1.0/.gitignore +16 -0
  5. kitkat-0.1.0/.python-version +1 -0
  6. kitkat-0.1.0/CHANGELOG.md +22 -0
  7. kitkat-0.1.0/CODE_OF_CONDUCT.md +128 -0
  8. kitkat-0.1.0/CONTRIBUTING.md +77 -0
  9. kitkat-0.1.0/LICENSE +21 -0
  10. kitkat-0.1.0/PKG-INFO +473 -0
  11. kitkat-0.1.0/README.md +392 -0
  12. kitkat-0.1.0/pyproject.toml +99 -0
  13. kitkat-0.1.0/src/kitkat/__init__.py +0 -0
  14. kitkat-0.1.0/src/kitkat/_internal/__init__.py +6 -0
  15. kitkat-0.1.0/src/kitkat/_internal/http.py +47 -0
  16. kitkat-0.1.0/src/kitkat/_internal/retry.py +102 -0
  17. kitkat-0.1.0/src/kitkat/_internal/tokenizers.py +76 -0
  18. kitkat-0.1.0/src/kitkat/abc/__init__.py +11 -0
  19. kitkat-0.1.0/src/kitkat/abc/provider.py +374 -0
  20. kitkat-0.1.0/src/kitkat/core/__init__.py +61 -0
  21. kitkat-0.1.0/src/kitkat/core/enums.py +36 -0
  22. kitkat-0.1.0/src/kitkat/core/exceptions.py +192 -0
  23. kitkat-0.1.0/src/kitkat/core/models.py +217 -0
  24. kitkat-0.1.0/src/kitkat/core/schemas.py +674 -0
  25. kitkat-0.1.0/src/kitkat/exceptions.py +33 -0
  26. kitkat-0.1.0/src/kitkat/providers/__init__.py +13 -0
  27. kitkat-0.1.0/src/kitkat/providers/_registry.py +123 -0
  28. kitkat-0.1.0/src/kitkat/providers/anthropic/__init__.py +33 -0
  29. kitkat-0.1.0/src/kitkat/providers/anthropic/provider.py +818 -0
  30. kitkat-0.1.0/src/kitkat/providers/gemini/__init__.py +36 -0
  31. kitkat-0.1.0/src/kitkat/providers/gemini/provider.py +742 -0
  32. kitkat-0.1.0/src/kitkat/providers/openai/__init__.py +37 -0
  33. kitkat-0.1.0/src/kitkat/providers/openai/provider.py +891 -0
  34. kitkat-0.1.0/src/kitkat/py.typed +0 -0
  35. kitkat-0.1.0/src/kitkat/service/byok.py +215 -0
  36. kitkat-0.1.0/src/kitkat/service/service.py +290 -0
  37. kitkat-0.1.0/tests/__init__.py +0 -0
  38. kitkat-0.1.0/tests/unit/__init__.py +0 -0
  39. kitkat-0.1.0/tests/unit/_internal/__init__.py +0 -0
  40. kitkat-0.1.0/tests/unit/_internal/test_retry.py +164 -0
  41. kitkat-0.1.0/tests/unit/_internal/test_tokenizers.py +66 -0
  42. kitkat-0.1.0/tests/unit/abc/__init__.py +0 -0
  43. kitkat-0.1.0/tests/unit/abc/test_provider.py +253 -0
  44. kitkat-0.1.0/tests/unit/core/__init__.py +0 -0
  45. kitkat-0.1.0/tests/unit/core/test_models.py +349 -0
  46. kitkat-0.1.0/tests/unit/providers/__init__.py +0 -0
  47. kitkat-0.1.0/tests/unit/providers/test_anthropic_error_map.py +156 -0
  48. kitkat-0.1.0/tests/unit/providers/test_anthropic_thinking.py +84 -0
  49. kitkat-0.1.0/tests/unit/providers/test_gemini_error_map.py +111 -0
  50. kitkat-0.1.0/tests/unit/providers/test_gemini_thinking.py +87 -0
  51. kitkat-0.1.0/tests/unit/providers/test_openai_error_map.py +156 -0
  52. kitkat-0.1.0/tests/unit/providers/test_openai_thinking.py +62 -0
  53. kitkat-0.1.0/tests/unit/providers/test_registry.py +86 -0
  54. kitkat-0.1.0/uv.lock +4601 -0
@@ -0,0 +1,23 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment:
11
+ name: pypi
12
+ url: https://pypi.org/p/kitkat
13
+ permissions:
14
+ id-token: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v5
19
+ - name: Build package
20
+ run: uv build
21
+
22
+ - name: Publish to PyPI
23
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,16 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ *.pyc
5
+ build/
6
+ dist/
7
+ wheels/
8
+ *.egg-info
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ htmlcov/
13
+ site/
14
+
15
+ # Virtual environments
16
+ .venv
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-06-23
11
+
12
+ ### Added
13
+ - **Core Models Layer (`kitkat.core`)**: Zero-dependency domain models (`LLMRequest`, `LLMResponse`, `StreamChunk`, `TokenUsage`) and enums (`Role`, `FinishReason`, `ProviderType`).
14
+ - **Exception Hierarchy (`kitkat.core.exceptions`)**: Unified, typed error handling across all providers (e.g., `LLMRateLimitError`, `LLMAuthenticationError`, `LLMTimeoutError`).
15
+ - **Provider ABC (`kitkat.abc.LLMProvider`)**: The abstract base class defining the contract for all provider implementations.
16
+ - **Anthropic Provider (`kitkat[anthropic]`)**: Full support for Claude models, including extended thinking via `ThinkingConfig`.
17
+ - **OpenAI Provider (`kitkat[openai]`)**: Compatible with OpenAI's Chat Completions API and alternative endpoints like NVIDIA NIM or vLLM via `base_url`. Includes o-series reasoning support.
18
+ - **Gemini Provider (`kitkat[gemini]`)**: Uses the new official `google-genai` SDK, with standard API key auth and Vertex AI enterprise deployment support (`vertexai=True`).
19
+ - **Async Streaming**: First-class async streaming for all providers via the `stream()` method, yielding typed `StreamChunk` objects.
20
+ - **Token Estimation**: Synchronous `count_tokens()` across all providers using a shared `tiktoken` implementation with an air-gapped character-ratio fallback.
21
+ - **Retry Logic**: Built-in exponential back-off wrapper with jitter that automatically handles transient errors (429, 5xx) and respects `Retry-After` HTTP headers.
22
+ - **Plugin Registry (`kitkat.providers._registry`)**: Provider auto-discovery via Python `entry-points`, allowing third-party packages to inject custom providers seamlessly.
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement.
63
+ All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series
85
+ of actions.
86
+
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or
92
+ permanent ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within
112
+ the community.
113
+
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,77 @@
1
+ # 🎉 Welcome to **Kitkat**!
2
+
3
+ We're excited that you're interested in contributing to our project!
4
+ We want to ensure that every user and contributor feels welcome, included and supported to participate in Pinac Workspace community. This guide will help you get started and ensure your contributions can be efficiently integrated into the project.
5
+
6
+ ## 1. Ways to Contribute
7
+
8
+ You can contribute to **Kitkat** in many ways:
9
+
10
+ - Submitting bug reports or feature requests
11
+ - Improving documentation
12
+ - Reviewing pull requests
13
+ -️ Contributing code or tests
14
+ - Helping other users
15
+
16
+ ## Issue Labels
17
+
18
+ To help you find the most appropriate issues to work on, we use the following labels:
19
+
20
+ - `good first issue` - Perfect for newcomers to the project
21
+ - `bug` - Something isn't working as expected
22
+ - `documentation` - Improvements or additions to documentation
23
+ - `enhancement` - New features or improvements
24
+ - `help wanted` - Extra attention or assistance needed
25
+ - `question` - Further information is requested
26
+ - `wontfix` - This will not be worked on
27
+
28
+ Looking for a place to start? Try filtering for [good first issues](https://github.com/RajeshTechForge/kitkat/labels/good%20first%20issue)!
29
+
30
+ ## 2. Development Setup
31
+
32
+ ### Fork and Clone
33
+
34
+ 1. Fork the [**kitkat**](https://github.com/RajeshTechForge/kitkat) repository
35
+ 2. Clone your fork:
36
+ ```shell
37
+ git clone https://github.com/RajeshTechForge/kitkat.git
38
+ cd kitkat
39
+ ```
40
+
41
+ ### Create a Branch
42
+
43
+ Create a new branch for your work:
44
+
45
+ ```shell
46
+ git checkout -b feat/your-feature-name
47
+ ```
48
+
49
+ ## 3. Making Changes
50
+
51
+ 1. **Code Style**: Follow the project's coding standards
52
+ 2. **Documentation**: Update relevant documentation
53
+ 3. **Commits**: Write clear commit messages
54
+
55
+ ## 4. Submitting Changes
56
+
57
+ 1. Self-check your changes:
58
+ - Verify code formatting and commets
59
+ - Review your changes for clarity and completeness
60
+ 2. Push your changes:
61
+ ```shell
62
+ git add .
63
+ git commit -m "Description of your changes"
64
+ git push origin feature/your-feature-name
65
+ ```
66
+ 3. Create a Pull Request:
67
+ - Go to the [**kitkat** repository](https://github.com/RajeshTechForge/kitkat)
68
+ - Click "Compare & Pull Request" and open a PR against main branch
69
+ - Fill in the PR template with details about your changes
70
+
71
+ ## 5. Community Guidelines
72
+
73
+ - Be respectful and inclusive
74
+ - Help others learn and grow
75
+ - Follow our [Code of Conduct](CODE_OF_CONDUCT.md)
76
+ - Provide constructive feedback
77
+ - Ask questions when unsure
kitkat-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rajesh Mondal (@RajeshTechForge)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.