stratifyai 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 (113) hide show
  1. stratifyai-0.1.0/LICENSE +21 -0
  2. stratifyai-0.1.0/MANIFEST.in +16 -0
  3. stratifyai-0.1.0/PKG-INFO +263 -0
  4. stratifyai-0.1.0/README.md +209 -0
  5. stratifyai-0.1.0/WARP.md +476 -0
  6. stratifyai-0.1.0/cli/__init__.py +5 -0
  7. stratifyai-0.1.0/cli/stratifyai_cli.py +1753 -0
  8. stratifyai-0.1.0/docs/API-REFERENCE.md +1027 -0
  9. stratifyai-0.1.0/docs/CHANGELOG.md +62 -0
  10. stratifyai-0.1.0/docs/CONTRIBUTING.md +600 -0
  11. stratifyai-0.1.0/docs/GETTING-STARTED.md +825 -0
  12. stratifyai-0.1.0/docs/LangChain_vs_StratifyAI_vs_LLMLite.md +37 -0
  13. stratifyai-0.1.0/docs/StatifyAI_For_Stakeholders.md +95 -0
  14. stratifyai-0.1.0/docs/StratifyAI-Prompt-Caching.md +312 -0
  15. stratifyai-0.1.0/docs/StratifyAI-Router-Logic.md +367 -0
  16. stratifyai-0.1.0/docs/Why_StratefiAI.md +2 -0
  17. stratifyai-0.1.0/docs/cli-usage.md +453 -0
  18. stratifyai-0.1.0/docs/frontend-integration.md +624 -0
  19. stratifyai-0.1.0/docs/large-file-strategies.md +487 -0
  20. stratifyai-0.1.0/docs/local-installation-guide.md +638 -0
  21. stratifyai-0.1.0/docs/performance.md +555 -0
  22. stratifyai-0.1.0/docs/provider-models-catalog.md +458 -0
  23. stratifyai-0.1.0/docs/quick-start-guide.md +382 -0
  24. stratifyai-0.1.0/docs/token-limit-quick-guide.md +282 -0
  25. stratifyai-0.1.0/examples/auto_selection_demo.py +189 -0
  26. stratifyai-0.1.0/examples/caching_examples.py +282 -0
  27. stratifyai-0.1.0/examples/chatbot.py +447 -0
  28. stratifyai-0.1.0/examples/cli_interactive_demo.md +166 -0
  29. stratifyai-0.1.0/examples/code_reviewer.py +368 -0
  30. stratifyai-0.1.0/examples/document_summarizer.py +365 -0
  31. stratifyai-0.1.0/examples/performance_benchmark.py +458 -0
  32. stratifyai-0.1.0/examples/rag_example.py +287 -0
  33. stratifyai-0.1.0/examples/router_example.py +196 -0
  34. stratifyai-0.1.0/examples/web_server.py +529 -0
  35. stratifyai-0.1.0/pyproject.toml +150 -0
  36. stratifyai-0.1.0/requirements.txt +82 -0
  37. stratifyai-0.1.0/setup.cfg +4 -0
  38. stratifyai-0.1.0/setup.py +9 -0
  39. stratifyai-0.1.0/stratifyai/__init__.py +113 -0
  40. stratifyai-0.1.0/stratifyai/api_key_helper.py +372 -0
  41. stratifyai-0.1.0/stratifyai/caching.py +279 -0
  42. stratifyai-0.1.0/stratifyai/chat/__init__.py +54 -0
  43. stratifyai-0.1.0/stratifyai/chat/builder.py +366 -0
  44. stratifyai-0.1.0/stratifyai/chat/stratifyai_anthropic.py +194 -0
  45. stratifyai-0.1.0/stratifyai/chat/stratifyai_bedrock.py +200 -0
  46. stratifyai-0.1.0/stratifyai/chat/stratifyai_deepseek.py +194 -0
  47. stratifyai-0.1.0/stratifyai/chat/stratifyai_google.py +194 -0
  48. stratifyai-0.1.0/stratifyai/chat/stratifyai_grok.py +194 -0
  49. stratifyai-0.1.0/stratifyai/chat/stratifyai_groq.py +195 -0
  50. stratifyai-0.1.0/stratifyai/chat/stratifyai_ollama.py +201 -0
  51. stratifyai-0.1.0/stratifyai/chat/stratifyai_openai.py +209 -0
  52. stratifyai-0.1.0/stratifyai/chat/stratifyai_openrouter.py +201 -0
  53. stratifyai-0.1.0/stratifyai/chunking.py +158 -0
  54. stratifyai-0.1.0/stratifyai/client.py +292 -0
  55. stratifyai-0.1.0/stratifyai/config.py +1273 -0
  56. stratifyai-0.1.0/stratifyai/cost_tracker.py +257 -0
  57. stratifyai-0.1.0/stratifyai/embeddings.py +245 -0
  58. stratifyai-0.1.0/stratifyai/exceptions.py +91 -0
  59. stratifyai-0.1.0/stratifyai/models.py +59 -0
  60. stratifyai-0.1.0/stratifyai/providers/__init__.py +5 -0
  61. stratifyai-0.1.0/stratifyai/providers/anthropic.py +330 -0
  62. stratifyai-0.1.0/stratifyai/providers/base.py +183 -0
  63. stratifyai-0.1.0/stratifyai/providers/bedrock.py +634 -0
  64. stratifyai-0.1.0/stratifyai/providers/deepseek.py +39 -0
  65. stratifyai-0.1.0/stratifyai/providers/google.py +39 -0
  66. stratifyai-0.1.0/stratifyai/providers/grok.py +39 -0
  67. stratifyai-0.1.0/stratifyai/providers/groq.py +39 -0
  68. stratifyai-0.1.0/stratifyai/providers/ollama.py +43 -0
  69. stratifyai-0.1.0/stratifyai/providers/openai.py +344 -0
  70. stratifyai-0.1.0/stratifyai/providers/openai_compatible.py +372 -0
  71. stratifyai-0.1.0/stratifyai/providers/openrouter.py +39 -0
  72. stratifyai-0.1.0/stratifyai/py.typed +2 -0
  73. stratifyai-0.1.0/stratifyai/rag.py +381 -0
  74. stratifyai-0.1.0/stratifyai/retry.py +185 -0
  75. stratifyai-0.1.0/stratifyai/router.py +643 -0
  76. stratifyai-0.1.0/stratifyai/summarization.py +179 -0
  77. stratifyai-0.1.0/stratifyai/utils/__init__.py +11 -0
  78. stratifyai-0.1.0/stratifyai/utils/bedrock_validator.py +136 -0
  79. stratifyai-0.1.0/stratifyai/utils/code_extractor.py +327 -0
  80. stratifyai-0.1.0/stratifyai/utils/csv_extractor.py +197 -0
  81. stratifyai-0.1.0/stratifyai/utils/file_analyzer.py +192 -0
  82. stratifyai-0.1.0/stratifyai/utils/json_extractor.py +219 -0
  83. stratifyai-0.1.0/stratifyai/utils/log_extractor.py +267 -0
  84. stratifyai-0.1.0/stratifyai/utils/model_selector.py +324 -0
  85. stratifyai-0.1.0/stratifyai/utils/provider_validator.py +442 -0
  86. stratifyai-0.1.0/stratifyai/utils/token_counter.py +186 -0
  87. stratifyai-0.1.0/stratifyai/vectordb.py +344 -0
  88. stratifyai-0.1.0/stratifyai.egg-info/PKG-INFO +263 -0
  89. stratifyai-0.1.0/stratifyai.egg-info/SOURCES.txt +111 -0
  90. stratifyai-0.1.0/stratifyai.egg-info/dependency_links.txt +1 -0
  91. stratifyai-0.1.0/stratifyai.egg-info/entry_points.txt +2 -0
  92. stratifyai-0.1.0/stratifyai.egg-info/requires.txt +32 -0
  93. stratifyai-0.1.0/stratifyai.egg-info/top_level.txt +2 -0
  94. stratifyai-0.1.0/tests/__init__.py +1 -0
  95. stratifyai-0.1.0/tests/test_async_operations.py +428 -0
  96. stratifyai-0.1.0/tests/test_bedrock_provider.py +488 -0
  97. stratifyai-0.1.0/tests/test_caching.py +429 -0
  98. stratifyai-0.1.0/tests/test_chat_builder.py +411 -0
  99. stratifyai-0.1.0/tests/test_cli_auth_error.py +176 -0
  100. stratifyai-0.1.0/tests/test_cli_chat.py +797 -0
  101. stratifyai-0.1.0/tests/test_cli_file_loading.py +563 -0
  102. stratifyai-0.1.0/tests/test_client.py +215 -0
  103. stratifyai-0.1.0/tests/test_model_selector.py +265 -0
  104. stratifyai-0.1.0/tests/test_models.py +146 -0
  105. stratifyai-0.1.0/tests/test_openai_provider.py +196 -0
  106. stratifyai-0.1.0/tests/test_phase71.py +208 -0
  107. stratifyai-0.1.0/tests/test_phase72_extractors.py +456 -0
  108. stratifyai-0.1.0/tests/test_phase74_caching.py +369 -0
  109. stratifyai-0.1.0/tests/test_providers_phase2.py +261 -0
  110. stratifyai-0.1.0/tests/test_router.py +426 -0
  111. stratifyai-0.1.0/tests/test_router_extraction.py +214 -0
  112. stratifyai-0.1.0/tests/test_temperature_unit.py +109 -0
  113. stratifyai-0.1.0/tests/test_temperature_validation.py +95 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Scott Jones
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.
@@ -0,0 +1,16 @@
1
+ include README.md
2
+ include LICENSE
3
+ include requirements.txt
4
+ include WARP.md
5
+
6
+ recursive-include docs *.md
7
+ recursive-include examples *.py *.md
8
+ recursive-include llm_abstraction *.py
9
+ recursive-include cli *.py
10
+ recursive-include tests *.py
11
+
12
+ global-exclude __pycache__
13
+ global-exclude *.py[co]
14
+ global-exclude .DS_Store
15
+ global-exclude *.so
16
+ global-exclude .gitignore
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: stratifyai
3
+ Version: 0.1.0
4
+ Summary: Unified multi-provider LLM abstraction module with intelligent routing, cost tracking, and caching
5
+ Author-email: Steven Cotton <cototnbytes@gmail.com>
6
+ Maintainer-email: Steven Cotton <cototnbytes@gmail.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/Bytes0211/stratifyai
9
+ Project-URL: Repository, https://github.com/Bytes0211/stratifyai
10
+ Project-URL: Documentation, https://github.com/Bytes0211/stratifyai#readme
11
+ Project-URL: Bug Tracker, https://github.com/Bytes0211/stratifyai/issues
12
+ Keywords: llm,openai,anthropic,google,gemini,ai,chatgpt,claude,deepseek,groq,grok,ollama,multi-provider,abstraction,routing,cost-tracking,caching
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: openai>=1.12.0
27
+ Requires-Dist: anthropic>=0.18.0
28
+ Requires-Dist: google-genai>=1.0.0
29
+ Requires-Dist: aioboto3>=12.0.0
30
+ Requires-Dist: boto3>=1.34.0
31
+ Requires-Dist: python-dotenv>=1.0.0
32
+ Requires-Dist: pydantic>=2.0.0
33
+ Requires-Dist: typing-extensions>=4.0.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=9.0.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
38
+ Requires-Dist: pytest-mock>=3.0.0; extra == "dev"
39
+ Requires-Dist: black>=23.0.0; extra == "dev"
40
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
41
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
42
+ Provides-Extra: cli
43
+ Requires-Dist: typer>=0.9.0; extra == "cli"
44
+ Requires-Dist: rich>=13.0.0; extra == "cli"
45
+ Provides-Extra: web
46
+ Requires-Dist: fastapi>=0.115.0; extra == "web"
47
+ Requires-Dist: uvicorn[standard]>=0.34.0; extra == "web"
48
+ Requires-Dist: websockets>=14.0; extra == "web"
49
+ Provides-Extra: rag
50
+ Requires-Dist: chromadb>=0.5.0; extra == "rag"
51
+ Provides-Extra: all
52
+ Requires-Dist: stratifyai[cli,dev,rag,web]; extra == "all"
53
+ Dynamic: license-file
54
+
55
+ ![StratifyAI](stratifyai_trans_logo.png)
56
+
57
+
58
+ # StratifyAI — Unified Multi‑Provider LLM Interface
59
+
60
+ ![Python](https://img.shields.io/badge/python-3.10%2B-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Tests](https://img.shields.io/badge/tests-300%2B%20passing-brightgreen) ![Providers](https://img.shields.io/badge/providers-9-orange)
61
+
62
+ **Status:** Phase 7.8 Complete
63
+ **Providers:** 9 Operational
64
+ **Features:** Routing • RAG • Caching • Streaming • CLI • Web UI • Builder Pattern
65
+
66
+ StratifyAI is a production‑ready Python framework that provides a unified interface for 9+ LLM providers, including OpenAI, Anthropic, Google, DeepSeek, Groq, Grok, OpenRouter, Ollama, and AWS Bedrock. It eliminates vendor lock‑in, simplifies multi‑model development, and enables intelligent routing, cost tracking, caching, streaming, and RAG workflows.
67
+
68
+ ---
69
+
70
+ ## Features
71
+
72
+ ### Core
73
+
74
+ - Unified API for 9+ LLM providers
75
+ - Async-first architecture with sync wrappers
76
+ - Automatic provider detection
77
+ - Cost tracking and budget enforcement
78
+ - Latency tracking on all responses
79
+ - Retry logic with fallback models
80
+ - Streaming support for all providers
81
+ - Response caching + provider prompt caching
82
+ - Intelligent routing (cost, quality, latency, hybrid)
83
+ - Capability filtering (vision, tools, reasoning)
84
+ - Model metadata and context window awareness
85
+ - **Builder pattern** for fluent configuration
86
+
87
+ ### Advanced
88
+
89
+ - Large‑file handling with chunking and progressive summarization
90
+ - File extraction (CSV schema, JSON schema, logs, code structure)
91
+ - Auto model selection for extraction tasks
92
+ - RAG pipeline with embeddings + vector DB (ChromaDB)
93
+ - Semantic search and citation tracking
94
+ - Rich/Typer CLI with interactive mode
95
+ - Optional FastAPI web interface
96
+
97
+ ---
98
+
99
+ ## Installation
100
+
101
+ ```bash
102
+ git clone https://github.com/Bytes0211/stratifyai.git
103
+ cd stratifyai
104
+ pip install -e .
105
+ ```
106
+
107
+ Or using `uv`:
108
+
109
+ ```bash
110
+ uv sync
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Configuration
116
+
117
+ ```bash
118
+ cp .env.example .env
119
+ # Add your API keys
120
+ ```
121
+
122
+ Check configured providers:
123
+
124
+ ```bash
125
+ stratifyai check-keys
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Quick Start
131
+
132
+ ### CLI Usage
133
+
134
+ ```bash
135
+ stratifyai chat -p openai -m gpt-4o-mini -t "Hello"
136
+ stratifyai route "Explain relativity" --strategy hybrid
137
+ stratifyai interactive
138
+ stratifyai cache-stats
139
+ ```
140
+
141
+ ### Python Example (LLMClient)
142
+
143
+ ```python
144
+ from stratifyai import LLMClient
145
+ from stratifyai.models import Message, ChatRequest, ChatResponse
146
+
147
+ client: LLMClient = LLMClient()
148
+ request: ChatRequest = ChatRequest(
149
+ model="gpt-4o-mini",
150
+ messages=[Message(role="user", content="Explain quantum computing")]
151
+ )
152
+
153
+ # Async (recommended)
154
+ response: ChatResponse = await client.chat_completion(request)
155
+
156
+ # Sync wrapper for scripts/CLI
157
+ response: ChatResponse = client.chat_completion_sync(request)
158
+
159
+ print(response.content)
160
+ print(f"Cost: ${response.usage.cost_usd:.6f}")
161
+ print(f"Latency: {response.latency_ms:.0f}ms")
162
+ ```
163
+
164
+ ### Python Example (Chat Package - Simplified)
165
+
166
+ ```python
167
+ from stratifyai.chat import anthropic, openai
168
+ from stratifyai.models import ChatResponse
169
+
170
+ # Quick usage - model is always required
171
+ response: ChatResponse = await anthropic.chat("Hello!", model="claude-sonnet-4-5")
172
+ print(response.content)
173
+
174
+ # With options
175
+ response: ChatResponse = await openai.chat(
176
+ "Explain quantum computing",
177
+ model="gpt-4o-mini",
178
+ system="Be concise",
179
+ temperature=0.5
180
+ )
181
+ ```
182
+
183
+ ### Builder Pattern (Fluent Configuration)
184
+
185
+ ```python
186
+ from stratifyai.chat import anthropic
187
+ from stratifyai.chat.builder import ChatBuilder
188
+ from stratifyai.models import ChatResponse
189
+
190
+ # Configure once, use multiple times
191
+ client: ChatBuilder = (
192
+ anthropic
193
+ .with_model("claude-sonnet-4-5")
194
+ .with_system("You are a helpful assistant")
195
+ .with_temperature(0.7)
196
+ )
197
+
198
+ # All subsequent calls use the configured settings
199
+ response: ChatResponse = await client.chat("Hello!")
200
+ response: ChatResponse = await client.chat("Tell me more")
201
+
202
+ # Stream with builder
203
+ async for chunk in client.chat_stream("Write a story"):
204
+ print(chunk.content, end="", flush=True)
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Routing
210
+
211
+ - **Cost**: choose cheapest model
212
+ - **Quality**: choose highest‑quality model
213
+ - **Latency**: choose fastest model
214
+ - **Hybrid (default)**: dynamic weighting based on complexity
215
+
216
+ ---
217
+
218
+ ## RAG
219
+
220
+ - Embeddings (OpenAI)
221
+ - ChromaDB vector storage
222
+ - Semantic search
223
+ - Document indexing
224
+ - Retrieval‑augmented generation
225
+ - Citation tracking
226
+
227
+ ---
228
+
229
+ ## Project Structure
230
+
231
+ ```
232
+ stratifyai/
233
+ ├── llm_abstraction/ # Core package
234
+ │ ├── providers/ # Provider implementations (9 providers)
235
+ │ ├── router.py # Intelligent routing
236
+ │ ├── models.py # Data models
237
+ │ └── utils/ # Utilities (token counting, extraction)
238
+ ├── chat/ # Simplified chat modules with builder pattern
239
+ │ ├── builder.py # ChatBuilder class
240
+ │ └── stratifyai_*.py # Provider-specific modules
241
+ ├── cli/ # Typer CLI
242
+ ├── api/ # Optional FastAPI server
243
+ ├── examples/ # Usage examples
244
+ └── docs/ # Technical documentation
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Testing
250
+
251
+ ```bash
252
+ pytest # Run all tests
253
+ pytest -v # Verbose output
254
+ ```
255
+
256
+ **Test Coverage:** 300+ tests across all modules
257
+
258
+ ---
259
+
260
+ ## License
261
+
262
+ Internal project — All rights reserved.
263
+
@@ -0,0 +1,209 @@
1
+ ![StratifyAI](stratifyai_trans_logo.png)
2
+
3
+
4
+ # StratifyAI — Unified Multi‑Provider LLM Interface
5
+
6
+ ![Python](https://img.shields.io/badge/python-3.10%2B-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Tests](https://img.shields.io/badge/tests-300%2B%20passing-brightgreen) ![Providers](https://img.shields.io/badge/providers-9-orange)
7
+
8
+ **Status:** Phase 7.8 Complete
9
+ **Providers:** 9 Operational
10
+ **Features:** Routing • RAG • Caching • Streaming • CLI • Web UI • Builder Pattern
11
+
12
+ StratifyAI is a production‑ready Python framework that provides a unified interface for 9+ LLM providers, including OpenAI, Anthropic, Google, DeepSeek, Groq, Grok, OpenRouter, Ollama, and AWS Bedrock. It eliminates vendor lock‑in, simplifies multi‑model development, and enables intelligent routing, cost tracking, caching, streaming, and RAG workflows.
13
+
14
+ ---
15
+
16
+ ## Features
17
+
18
+ ### Core
19
+
20
+ - Unified API for 9+ LLM providers
21
+ - Async-first architecture with sync wrappers
22
+ - Automatic provider detection
23
+ - Cost tracking and budget enforcement
24
+ - Latency tracking on all responses
25
+ - Retry logic with fallback models
26
+ - Streaming support for all providers
27
+ - Response caching + provider prompt caching
28
+ - Intelligent routing (cost, quality, latency, hybrid)
29
+ - Capability filtering (vision, tools, reasoning)
30
+ - Model metadata and context window awareness
31
+ - **Builder pattern** for fluent configuration
32
+
33
+ ### Advanced
34
+
35
+ - Large‑file handling with chunking and progressive summarization
36
+ - File extraction (CSV schema, JSON schema, logs, code structure)
37
+ - Auto model selection for extraction tasks
38
+ - RAG pipeline with embeddings + vector DB (ChromaDB)
39
+ - Semantic search and citation tracking
40
+ - Rich/Typer CLI with interactive mode
41
+ - Optional FastAPI web interface
42
+
43
+ ---
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ git clone https://github.com/Bytes0211/stratifyai.git
49
+ cd stratifyai
50
+ pip install -e .
51
+ ```
52
+
53
+ Or using `uv`:
54
+
55
+ ```bash
56
+ uv sync
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Configuration
62
+
63
+ ```bash
64
+ cp .env.example .env
65
+ # Add your API keys
66
+ ```
67
+
68
+ Check configured providers:
69
+
70
+ ```bash
71
+ stratifyai check-keys
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Quick Start
77
+
78
+ ### CLI Usage
79
+
80
+ ```bash
81
+ stratifyai chat -p openai -m gpt-4o-mini -t "Hello"
82
+ stratifyai route "Explain relativity" --strategy hybrid
83
+ stratifyai interactive
84
+ stratifyai cache-stats
85
+ ```
86
+
87
+ ### Python Example (LLMClient)
88
+
89
+ ```python
90
+ from stratifyai import LLMClient
91
+ from stratifyai.models import Message, ChatRequest, ChatResponse
92
+
93
+ client: LLMClient = LLMClient()
94
+ request: ChatRequest = ChatRequest(
95
+ model="gpt-4o-mini",
96
+ messages=[Message(role="user", content="Explain quantum computing")]
97
+ )
98
+
99
+ # Async (recommended)
100
+ response: ChatResponse = await client.chat_completion(request)
101
+
102
+ # Sync wrapper for scripts/CLI
103
+ response: ChatResponse = client.chat_completion_sync(request)
104
+
105
+ print(response.content)
106
+ print(f"Cost: ${response.usage.cost_usd:.6f}")
107
+ print(f"Latency: {response.latency_ms:.0f}ms")
108
+ ```
109
+
110
+ ### Python Example (Chat Package - Simplified)
111
+
112
+ ```python
113
+ from stratifyai.chat import anthropic, openai
114
+ from stratifyai.models import ChatResponse
115
+
116
+ # Quick usage - model is always required
117
+ response: ChatResponse = await anthropic.chat("Hello!", model="claude-sonnet-4-5")
118
+ print(response.content)
119
+
120
+ # With options
121
+ response: ChatResponse = await openai.chat(
122
+ "Explain quantum computing",
123
+ model="gpt-4o-mini",
124
+ system="Be concise",
125
+ temperature=0.5
126
+ )
127
+ ```
128
+
129
+ ### Builder Pattern (Fluent Configuration)
130
+
131
+ ```python
132
+ from stratifyai.chat import anthropic
133
+ from stratifyai.chat.builder import ChatBuilder
134
+ from stratifyai.models import ChatResponse
135
+
136
+ # Configure once, use multiple times
137
+ client: ChatBuilder = (
138
+ anthropic
139
+ .with_model("claude-sonnet-4-5")
140
+ .with_system("You are a helpful assistant")
141
+ .with_temperature(0.7)
142
+ )
143
+
144
+ # All subsequent calls use the configured settings
145
+ response: ChatResponse = await client.chat("Hello!")
146
+ response: ChatResponse = await client.chat("Tell me more")
147
+
148
+ # Stream with builder
149
+ async for chunk in client.chat_stream("Write a story"):
150
+ print(chunk.content, end="", flush=True)
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Routing
156
+
157
+ - **Cost**: choose cheapest model
158
+ - **Quality**: choose highest‑quality model
159
+ - **Latency**: choose fastest model
160
+ - **Hybrid (default)**: dynamic weighting based on complexity
161
+
162
+ ---
163
+
164
+ ## RAG
165
+
166
+ - Embeddings (OpenAI)
167
+ - ChromaDB vector storage
168
+ - Semantic search
169
+ - Document indexing
170
+ - Retrieval‑augmented generation
171
+ - Citation tracking
172
+
173
+ ---
174
+
175
+ ## Project Structure
176
+
177
+ ```
178
+ stratifyai/
179
+ ├── llm_abstraction/ # Core package
180
+ │ ├── providers/ # Provider implementations (9 providers)
181
+ │ ├── router.py # Intelligent routing
182
+ │ ├── models.py # Data models
183
+ │ └── utils/ # Utilities (token counting, extraction)
184
+ ├── chat/ # Simplified chat modules with builder pattern
185
+ │ ├── builder.py # ChatBuilder class
186
+ │ └── stratifyai_*.py # Provider-specific modules
187
+ ├── cli/ # Typer CLI
188
+ ├── api/ # Optional FastAPI server
189
+ ├── examples/ # Usage examples
190
+ └── docs/ # Technical documentation
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Testing
196
+
197
+ ```bash
198
+ pytest # Run all tests
199
+ pytest -v # Verbose output
200
+ ```
201
+
202
+ **Test Coverage:** 300+ tests across all modules
203
+
204
+ ---
205
+
206
+ ## License
207
+
208
+ Internal project — All rights reserved.
209
+