cost-katana 1.0.2__py3-none-any.whl → 1.0.3__py3-none-any.whl
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.
- cost_katana/__init__.py +1 -1
- {cost_katana-1.0.2.dist-info → cost_katana-1.0.3.dist-info}/METADATA +232 -2
- {cost_katana-1.0.2.dist-info → cost_katana-1.0.3.dist-info}/RECORD +7 -7
- {cost_katana-1.0.2.dist-info → cost_katana-1.0.3.dist-info}/WHEEL +0 -0
- {cost_katana-1.0.2.dist-info → cost_katana-1.0.3.dist-info}/entry_points.txt +0 -0
- {cost_katana-1.0.2.dist-info → cost_katana-1.0.3.dist-info}/licenses/LICENSE +0 -0
- {cost_katana-1.0.2.dist-info → cost_katana-1.0.3.dist-info}/top_level.txt +0 -0
cost_katana/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: cost-katana
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.3
|
4
4
|
Summary: Unified AI interface with cost optimization and failover
|
5
5
|
Home-page: https://github.com/Hypothesize-Tech/cost-katana-python
|
6
6
|
Author: Cost Katana Team
|
@@ -264,7 +264,7 @@ balanced_response = model.generate_content(
|
|
264
264
|
|
265
265
|
## 🖥️ Command Line Interface
|
266
266
|
|
267
|
-
Cost Katana includes a CLI for easy interaction:
|
267
|
+
Cost Katana includes a comprehensive CLI for easy interaction:
|
268
268
|
|
269
269
|
```bash
|
270
270
|
# Initialize configuration
|
@@ -283,6 +283,198 @@ cost-katana chat --model gemini-2.0-flash
|
|
283
283
|
cost-katana chat --config my-config.json
|
284
284
|
```
|
285
285
|
|
286
|
+
## 🧬 SAST (Semantic Abstract Syntax Tree) Features
|
287
|
+
|
288
|
+
Cost Katana includes advanced SAST capabilities for semantic optimization and analysis:
|
289
|
+
|
290
|
+
### SAST Optimization
|
291
|
+
|
292
|
+
```bash
|
293
|
+
# Optimize a prompt using SAST
|
294
|
+
cost-katana sast optimize "Write a detailed analysis of market trends"
|
295
|
+
|
296
|
+
# Optimize from file
|
297
|
+
cost-katana sast optimize --file prompt.txt --output optimized.txt
|
298
|
+
|
299
|
+
# Cross-lingual optimization
|
300
|
+
cost-katana sast optimize "Analyze data" --cross-lingual --language en
|
301
|
+
|
302
|
+
# Preserve ambiguity for analysis
|
303
|
+
cost-katana sast optimize "Complex query" --preserve-ambiguity
|
304
|
+
```
|
305
|
+
|
306
|
+
### SAST Comparison
|
307
|
+
|
308
|
+
```bash
|
309
|
+
# Compare traditional vs SAST optimization
|
310
|
+
cost-katana sast compare "Your prompt here"
|
311
|
+
|
312
|
+
# Compare with specific language
|
313
|
+
cost-katana sast compare --file prompt.txt --language en
|
314
|
+
```
|
315
|
+
|
316
|
+
### SAST Vocabulary & Analytics
|
317
|
+
|
318
|
+
```bash
|
319
|
+
# Explore SAST vocabulary
|
320
|
+
cost-katana sast vocabulary
|
321
|
+
|
322
|
+
# Search semantic primitives
|
323
|
+
cost-katana sast vocabulary --search "analysis" --category "action"
|
324
|
+
|
325
|
+
# Get SAST performance statistics
|
326
|
+
cost-katana sast stats
|
327
|
+
|
328
|
+
# View SAST showcase with examples
|
329
|
+
cost-katana sast showcase
|
330
|
+
|
331
|
+
# Telescope ambiguity demonstration
|
332
|
+
cost-katana sast telescope
|
333
|
+
|
334
|
+
# Test universal semantics across languages
|
335
|
+
cost-katana sast universal "concept" --languages "en,es,fr"
|
336
|
+
```
|
337
|
+
|
338
|
+
### SAST Python API
|
339
|
+
|
340
|
+
```python
|
341
|
+
import cost_katana as ck
|
342
|
+
|
343
|
+
ck.configure(api_key='dak_your_key_here')
|
344
|
+
client = ck.CostKatanaClient()
|
345
|
+
|
346
|
+
# Optimize with SAST
|
347
|
+
result = client.optimize_with_sast(
|
348
|
+
prompt="Your prompt here",
|
349
|
+
language="en",
|
350
|
+
cross_lingual=True,
|
351
|
+
preserve_ambiguity=False
|
352
|
+
)
|
353
|
+
|
354
|
+
# Compare SAST vs traditional
|
355
|
+
comparison = client.compare_sast_vs_traditional(
|
356
|
+
prompt="Your prompt here",
|
357
|
+
language="en"
|
358
|
+
)
|
359
|
+
|
360
|
+
# Get SAST vocabulary stats
|
361
|
+
stats = client.get_sast_vocabulary_stats()
|
362
|
+
|
363
|
+
# Search semantic primitives
|
364
|
+
primitives = client.search_semantic_primitives(
|
365
|
+
term="analysis",
|
366
|
+
category="action",
|
367
|
+
limit=10
|
368
|
+
)
|
369
|
+
|
370
|
+
# Test universal semantics
|
371
|
+
universal_test = client.test_universal_semantics(
|
372
|
+
concept="love",
|
373
|
+
languages=["en", "es", "fr"]
|
374
|
+
)
|
375
|
+
```
|
376
|
+
|
377
|
+
## 🧠 Cortex Engine Features
|
378
|
+
|
379
|
+
Cost Katana's Cortex engine provides intelligent processing capabilities:
|
380
|
+
|
381
|
+
### Cortex Operations
|
382
|
+
|
383
|
+
```python
|
384
|
+
import cost_katana as ck
|
385
|
+
|
386
|
+
ck.configure(api_key='dak_your_key_here')
|
387
|
+
client = ck.CostKatanaClient()
|
388
|
+
|
389
|
+
# Enable Cortex with SAST processing
|
390
|
+
result = client.optimize_with_sast(
|
391
|
+
prompt="Your prompt",
|
392
|
+
service="openai",
|
393
|
+
model="gpt-4o-mini",
|
394
|
+
# Cortex features
|
395
|
+
enableCortex=True,
|
396
|
+
cortexOperation="sast",
|
397
|
+
cortexStyle="conversational",
|
398
|
+
cortexFormat="plain",
|
399
|
+
cortexSemanticCache=True,
|
400
|
+
cortexPreserveSemantics=True,
|
401
|
+
cortexIntelligentRouting=True,
|
402
|
+
cortexSastProcessing=True,
|
403
|
+
cortexAmbiguityResolution=True,
|
404
|
+
cortexCrossLingualMode=False
|
405
|
+
)
|
406
|
+
```
|
407
|
+
|
408
|
+
### Cortex Capabilities
|
409
|
+
|
410
|
+
- **Semantic Caching**: Intelligent caching of semantic representations
|
411
|
+
- **Intelligent Routing**: Smart routing based on content analysis
|
412
|
+
- **Ambiguity Resolution**: Automatic resolution of ambiguous language
|
413
|
+
- **Cross-lingual Processing**: Multi-language semantic understanding
|
414
|
+
- **Semantic Preservation**: Maintains semantic meaning during optimization
|
415
|
+
|
416
|
+
## 🌐 Gateway Features
|
417
|
+
|
418
|
+
Cost Katana acts as a unified gateway to multiple AI providers:
|
419
|
+
|
420
|
+
### Provider Abstraction
|
421
|
+
|
422
|
+
```python
|
423
|
+
import cost_katana as ck
|
424
|
+
|
425
|
+
ck.configure(api_key='dak_your_key_here')
|
426
|
+
|
427
|
+
# Same interface, different providers
|
428
|
+
models = [
|
429
|
+
'nova-lite', # Amazon Nova
|
430
|
+
'claude-3-sonnet', # Anthropic Claude
|
431
|
+
'gemini-2.0-flash', # Google Gemini
|
432
|
+
'gpt-4', # OpenAI GPT
|
433
|
+
'llama-3.1-70b' # Meta Llama
|
434
|
+
]
|
435
|
+
|
436
|
+
for model in models:
|
437
|
+
response = ck.GenerativeModel(model).generate_content("Hello!")
|
438
|
+
print(f"{model}: {response.text[:50]}...")
|
439
|
+
```
|
440
|
+
|
441
|
+
### Intelligent Routing
|
442
|
+
|
443
|
+
```python
|
444
|
+
# Cost Katana automatically routes to the best provider
|
445
|
+
model = ck.GenerativeModel('balanced') # Uses intelligent routing
|
446
|
+
|
447
|
+
# Different optimization modes
|
448
|
+
fast_response = model.generate_content(
|
449
|
+
"Quick summary",
|
450
|
+
chat_mode='fastest' # Routes to fastest provider
|
451
|
+
)
|
452
|
+
|
453
|
+
cheap_response = model.generate_content(
|
454
|
+
"Detailed analysis",
|
455
|
+
chat_mode='cheapest' # Routes to most cost-effective provider
|
456
|
+
)
|
457
|
+
|
458
|
+
balanced_response = model.generate_content(
|
459
|
+
"Complex reasoning",
|
460
|
+
chat_mode='balanced' # Balances speed and cost
|
461
|
+
)
|
462
|
+
```
|
463
|
+
|
464
|
+
### Failover & Redundancy
|
465
|
+
|
466
|
+
```python
|
467
|
+
# Automatic failover if primary provider is down
|
468
|
+
model = ck.GenerativeModel('claude-3-sonnet')
|
469
|
+
|
470
|
+
try:
|
471
|
+
response = model.generate_content("Your prompt")
|
472
|
+
except ck.ModelNotAvailableError:
|
473
|
+
# Cost Katana automatically tries alternative providers
|
474
|
+
print("Primary model unavailable, using fallback...")
|
475
|
+
response = model.generate_content("Your prompt")
|
476
|
+
```
|
477
|
+
|
286
478
|
## 📊 Usage Analytics
|
287
479
|
|
288
480
|
Track your AI usage and costs:
|
@@ -400,6 +592,30 @@ class ChatSession:
|
|
400
592
|
def delete_conversation(self) -> None
|
401
593
|
```
|
402
594
|
|
595
|
+
### CostKatanaClient
|
596
|
+
|
597
|
+
```python
|
598
|
+
class CostKatanaClient:
|
599
|
+
def __init__(self, api_key: str = None, base_url: str = None, config_file: str = None)
|
600
|
+
|
601
|
+
# Core Methods
|
602
|
+
def send_message(self, message: str, model_id: str, **kwargs) -> Dict[str, Any]
|
603
|
+
def get_available_models(self) -> List[Dict[str, Any]]
|
604
|
+
def create_conversation(self, title: str = None, model_id: str = None) -> Dict[str, Any]
|
605
|
+
def get_conversation_history(self, conversation_id: str) -> Dict[str, Any]
|
606
|
+
def delete_conversation(self, conversation_id: str) -> Dict[str, Any]
|
607
|
+
|
608
|
+
# SAST Methods
|
609
|
+
def optimize_with_sast(self, prompt: str, **kwargs) -> Dict[str, Any]
|
610
|
+
def compare_sast_vs_traditional(self, prompt: str, **kwargs) -> Dict[str, Any]
|
611
|
+
def get_sast_vocabulary_stats(self) -> Dict[str, Any]
|
612
|
+
def search_semantic_primitives(self, term: str = None, **kwargs) -> Dict[str, Any]
|
613
|
+
def get_telescope_demo(self) -> Dict[str, Any]
|
614
|
+
def test_universal_semantics(self, concept: str, languages: List[str] = None) -> Dict[str, Any]
|
615
|
+
def get_sast_stats(self) -> Dict[str, Any]
|
616
|
+
def get_sast_showcase(self) -> Dict[str, Any]
|
617
|
+
```
|
618
|
+
|
403
619
|
### GenerateContentResponse
|
404
620
|
|
405
621
|
```python
|
@@ -409,6 +625,20 @@ class GenerateContentResponse:
|
|
409
625
|
thinking: Dict # AI reasoning (if available)
|
410
626
|
```
|
411
627
|
|
628
|
+
### UsageMetadata
|
629
|
+
|
630
|
+
```python
|
631
|
+
class UsageMetadata:
|
632
|
+
model: str # Model used
|
633
|
+
cost: float # Cost in USD
|
634
|
+
latency: float # Response time in seconds
|
635
|
+
total_tokens: int # Total tokens used
|
636
|
+
cache_hit: bool # Whether response was cached
|
637
|
+
risk_level: str # Risk assessment level
|
638
|
+
agent_path: List[str] # Multi-agent processing path
|
639
|
+
optimizations_applied: List[str] # Applied optimizations
|
640
|
+
```
|
641
|
+
|
412
642
|
## 🤝 Support
|
413
643
|
|
414
644
|
- **Documentation**: [docs.costkatana.com](https://docs.costkatana.com)
|
@@ -1,12 +1,12 @@
|
|
1
|
-
cost_katana/__init__.py,sha256=
|
1
|
+
cost_katana/__init__.py,sha256=meO0YYq0v7NaK4tK3RgK6JktNFrSCPXJB8QApz7uWy8,1754
|
2
2
|
cost_katana/cli.py,sha256=Xe88QKiNdB1aBnV60sSHLSvJ6YSk-BB9Ke45PSGp72Y,29404
|
3
3
|
cost_katana/client.py,sha256=gZX_-VC2gMuOjXO5XP2-YHElAy2K09XdhZW1jebeSLM,15782
|
4
4
|
cost_katana/config.py,sha256=5uxS_8Qqcb1FlINNMdVl1vxJ_n3FK2BHlJGpeJsoXL0,6792
|
5
5
|
cost_katana/exceptions.py,sha256=VNwc9lpShHQkHsgpAB-w-QJLNH6XRhuUzuXmbj9I9I8,963
|
6
6
|
cost_katana/models.py,sha256=zmPSVF8sLhSu1-o47_cq1Up3FkN6mE_Co9kaBJiCcIE,11602
|
7
|
-
cost_katana-1.0.
|
8
|
-
cost_katana-1.0.
|
9
|
-
cost_katana-1.0.
|
10
|
-
cost_katana-1.0.
|
11
|
-
cost_katana-1.0.
|
12
|
-
cost_katana-1.0.
|
7
|
+
cost_katana-1.0.3.dist-info/licenses/LICENSE,sha256=P7-BNX2xxJZ11R7KpNzczN_H1KJ6R8TisirpIQZWSzw,1067
|
8
|
+
cost_katana-1.0.3.dist-info/METADATA,sha256=6beNp0UWrYzH5KrrIaqbVnxVzX7Eep4jMYvCwpjdAgI,18817
|
9
|
+
cost_katana-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
10
|
+
cost_katana-1.0.3.dist-info/entry_points.txt,sha256=vJX-F_Xy4kOoGDZr29uOxB9Iu8ZJDgi4u5NC4_XwFEA,53
|
11
|
+
cost_katana-1.0.3.dist-info/top_level.txt,sha256=VdbCDM3Xp_40Yu73-xCGWUJRn0pPs6kc0iMU3yd59lo,12
|
12
|
+
cost_katana-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|