smartflow-sdk 0.2.0__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.
- smartflow/__init__.py +129 -0
- smartflow/client.py +1160 -0
- smartflow/exceptions.py +120 -0
- smartflow/sync.py +386 -0
- smartflow/types.py +526 -0
- smartflow_sdk-0.2.0.dist-info/METADATA +345 -0
- smartflow_sdk-0.2.0.dist-info/RECORD +10 -0
- smartflow_sdk-0.2.0.dist-info/WHEEL +5 -0
- smartflow_sdk-0.2.0.dist-info/licenses/LICENSE +22 -0
- smartflow_sdk-0.2.0.dist-info/top_level.txt +1 -0
smartflow/__init__.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Smartflow SDK - Developer-friendly AI orchestration, caching, and governance.
|
|
3
|
+
|
|
4
|
+
Connect to a deployed Smartflow instance and leverage enterprise AI infrastructure.
|
|
5
|
+
|
|
6
|
+
Quick Start:
|
|
7
|
+
>>> from smartflow import SmartflowClient
|
|
8
|
+
>>>
|
|
9
|
+
>>> async with SmartflowClient("http://your-smartflow:7775") as sf:
|
|
10
|
+
... response = await sf.chat("What is machine learning?")
|
|
11
|
+
... print(response)
|
|
12
|
+
|
|
13
|
+
Synchronous Usage:
|
|
14
|
+
>>> from smartflow import SyncSmartflowClient
|
|
15
|
+
>>>
|
|
16
|
+
>>> sf = SyncSmartflowClient("http://your-smartflow:7775")
|
|
17
|
+
>>> response = sf.chat("What is machine learning?")
|
|
18
|
+
>>> print(response)
|
|
19
|
+
|
|
20
|
+
OpenAI Drop-in Replacement:
|
|
21
|
+
>>> from openai import OpenAI
|
|
22
|
+
>>>
|
|
23
|
+
>>> # Just change the base_url!
|
|
24
|
+
>>> client = OpenAI(base_url="http://your-smartflow:7775/v1")
|
|
25
|
+
>>> response = client.chat.completions.create(...)
|
|
26
|
+
|
|
27
|
+
Build AI Agents:
|
|
28
|
+
>>> from smartflow import SmartflowClient, SmartflowAgent
|
|
29
|
+
>>>
|
|
30
|
+
>>> async with SmartflowClient("http://your-smartflow:7775") as sf:
|
|
31
|
+
... agent = SmartflowAgent(
|
|
32
|
+
... client=sf,
|
|
33
|
+
... name="CustomerSupport",
|
|
34
|
+
... system_prompt="You are a helpful support agent.",
|
|
35
|
+
... )
|
|
36
|
+
... response = await agent.chat("How do I reset my password?")
|
|
37
|
+
|
|
38
|
+
Intelligent Compliance:
|
|
39
|
+
>>> result = await sf.intelligent_scan(
|
|
40
|
+
... "My SSN is 123-45-6789",
|
|
41
|
+
... user_id="user123",
|
|
42
|
+
... org_id="acme_corp"
|
|
43
|
+
... )
|
|
44
|
+
>>> print(f"Risk: {result.risk_level}, Action: {result.recommended_action}")
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
__version__ = "0.2.0"
|
|
48
|
+
__author__ = "Langsmart, Inc."
|
|
49
|
+
|
|
50
|
+
from .client import SmartflowClient, SmartflowAgent, SmartflowWorkflow
|
|
51
|
+
from .sync import SyncSmartflowClient
|
|
52
|
+
from .types import (
|
|
53
|
+
# Core AI types
|
|
54
|
+
AIRequest,
|
|
55
|
+
AIResponse,
|
|
56
|
+
ChatMessage,
|
|
57
|
+
Usage,
|
|
58
|
+
Choice,
|
|
59
|
+
# Basic Compliance
|
|
60
|
+
ComplianceResult,
|
|
61
|
+
PolicyResult,
|
|
62
|
+
# Intelligent Compliance (ML-powered)
|
|
63
|
+
IntelligentScanResult,
|
|
64
|
+
LearningStatus,
|
|
65
|
+
LearningSummary,
|
|
66
|
+
MLStats,
|
|
67
|
+
OrgBaseline,
|
|
68
|
+
PersistenceStats,
|
|
69
|
+
# Cache & Monitoring
|
|
70
|
+
CacheStats,
|
|
71
|
+
ProviderHealth,
|
|
72
|
+
VASLog,
|
|
73
|
+
SystemHealth,
|
|
74
|
+
# Agent Building
|
|
75
|
+
AgentConfig,
|
|
76
|
+
WorkflowStep,
|
|
77
|
+
WorkflowResult,
|
|
78
|
+
)
|
|
79
|
+
from .exceptions import (
|
|
80
|
+
SmartflowError,
|
|
81
|
+
ConnectionError,
|
|
82
|
+
AuthenticationError,
|
|
83
|
+
RateLimitError,
|
|
84
|
+
ComplianceError,
|
|
85
|
+
ProviderError,
|
|
86
|
+
TimeoutError,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
__all__ = [
|
|
90
|
+
# Clients
|
|
91
|
+
"SmartflowClient",
|
|
92
|
+
"SyncSmartflowClient",
|
|
93
|
+
# Agent Building
|
|
94
|
+
"SmartflowAgent",
|
|
95
|
+
"SmartflowWorkflow",
|
|
96
|
+
# Core AI Types
|
|
97
|
+
"AIRequest",
|
|
98
|
+
"AIResponse",
|
|
99
|
+
"ChatMessage",
|
|
100
|
+
"Usage",
|
|
101
|
+
"Choice",
|
|
102
|
+
# Basic Compliance
|
|
103
|
+
"ComplianceResult",
|
|
104
|
+
"PolicyResult",
|
|
105
|
+
# Intelligent Compliance (ML-powered)
|
|
106
|
+
"IntelligentScanResult",
|
|
107
|
+
"LearningStatus",
|
|
108
|
+
"LearningSummary",
|
|
109
|
+
"MLStats",
|
|
110
|
+
"OrgBaseline",
|
|
111
|
+
"PersistenceStats",
|
|
112
|
+
# Cache & Monitoring
|
|
113
|
+
"CacheStats",
|
|
114
|
+
"ProviderHealth",
|
|
115
|
+
"VASLog",
|
|
116
|
+
"SystemHealth",
|
|
117
|
+
# Agent Building Types
|
|
118
|
+
"AgentConfig",
|
|
119
|
+
"WorkflowStep",
|
|
120
|
+
"WorkflowResult",
|
|
121
|
+
# Exceptions
|
|
122
|
+
"SmartflowError",
|
|
123
|
+
"ConnectionError",
|
|
124
|
+
"AuthenticationError",
|
|
125
|
+
"RateLimitError",
|
|
126
|
+
"ComplianceError",
|
|
127
|
+
"ProviderError",
|
|
128
|
+
"TimeoutError",
|
|
129
|
+
]
|