omnixon-lib 3.0.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.
omnixon/__init__.py ADDED
@@ -0,0 +1,91 @@
1
+ from .main import Client, MessageStream
2
+ from .schemes import (
3
+ User,
4
+ RecentUser,
5
+ Message,
6
+ MessageResponse,
7
+ TraceStep,
8
+ Agent,
9
+ EmbeddingStatus,
10
+ AgentVersion,
11
+ Attachment,
12
+ VersionDiff,
13
+ Block,
14
+ BlockType,
15
+ ClientTool,
16
+ ToolCall,
17
+ ToolRecord,
18
+ ToolResult,
19
+ Defaults,
20
+ Token,
21
+ NewToken,
22
+ Role,
23
+ ROLES,
24
+ DailyUsage,
25
+ MonthlyUsage,
26
+ RAG,
27
+ Model,
28
+ Interrupted,
29
+ Chat,
30
+ MCPServer,
31
+ CoreBlock,
32
+ ArchivalPassage,
33
+ RecallHit,
34
+ MemoryUser,
35
+ MemfsEntry,
36
+ MemfsFile,
37
+ MemfsRevision,
38
+ MemfsHit,
39
+ MemfsUser,
40
+ StoreStatus,
41
+ EvalCreate,
42
+ EvalResult,
43
+ EvalRun,
44
+ EvalVersionScore,
45
+ )
46
+
47
+ __all__ = [
48
+ "EvalCreate",
49
+ "EvalResult",
50
+ "EvalRun",
51
+ "EvalVersionScore",
52
+ "Client",
53
+ "MessageStream",
54
+ # Schemes
55
+ "User",
56
+ "RecentUser",
57
+ "Message",
58
+ "MessageResponse",
59
+ "TraceStep",
60
+ "Agent",
61
+ "EmbeddingStatus",
62
+ "AgentVersion",
63
+ "Attachment",
64
+ "VersionDiff",
65
+ "Block",
66
+ "BlockType",
67
+ "ClientTool",
68
+ "ToolResult",
69
+ "Defaults",
70
+ "Token",
71
+ "NewToken",
72
+ "Role",
73
+ "ROLES",
74
+ "DailyUsage",
75
+ "MonthlyUsage",
76
+ "RAG",
77
+ "Model",
78
+ "Interrupted",
79
+ "Chat",
80
+ "MCPServer",
81
+ "CoreBlock",
82
+ "ArchivalPassage",
83
+ "RecallHit",
84
+ "MemoryUser",
85
+ "MemfsEntry",
86
+ "MemfsFile",
87
+ "MemfsRevision",
88
+ "MemfsHit",
89
+ "MemfsUser",
90
+ "StoreStatus",
91
+ ]
omnixon/exceptions.py ADDED
@@ -0,0 +1,68 @@
1
+ class UnlinkError(Exception):
2
+ """Base exception for all Unlink client errors."""
3
+
4
+ def __init__(self, message: str, status_code: int = None):
5
+ super().__init__(message)
6
+ self.status_code = status_code
7
+
8
+
9
+ class NotFound(UnlinkError):
10
+ """Raised when the requested resource does not exist (HTTP 404)."""
11
+
12
+ def __init__(self, message: str = "Resource not found"):
13
+ super().__init__(message, status_code=404)
14
+
15
+
16
+ class NoAccess(UnlinkError):
17
+ """Raised when the token is invalid or lacks permission (HTTP 401/403)."""
18
+
19
+ def __init__(self, message: str = "Access denied: invalid or missing token"):
20
+ super().__init__(message, status_code=403)
21
+
22
+
23
+ class Conflict(UnlinkError):
24
+ """Raised when the request conflicts with the current state (HTTP 409)."""
25
+
26
+ def __init__(self, message: str = "Conflict: resource already exists"):
27
+ super().__init__(message, status_code=409)
28
+
29
+
30
+ class InvalidRequest(UnlinkError):
31
+ """Raised when the service rejects the data of a request (HTTP 422)."""
32
+
33
+ def __init__(self, message: str = "Invalid request"):
34
+ super().__init__(message, status_code=422)
35
+
36
+
37
+ class UpstreamError(UnlinkError):
38
+ """Raised when what the service depends on failed: the model provider or an MCP
39
+ server returned an error (HTTP 502) or timed out (HTTP 504). The service itself
40
+ works; the message says what went wrong, and a retry may help."""
41
+
42
+ def __init__(
43
+ self, message: str = "Upstream service failed", status_code: int = 502
44
+ ):
45
+ super().__init__(message, status_code=status_code)
46
+
47
+
48
+ class ConnectionError(UnlinkError):
49
+ """Raised when the client cannot reach the API."""
50
+
51
+ def __init__(self, message: str = "Cannot connect to the API"):
52
+ super().__init__(message)
53
+
54
+
55
+ class StreamError(UnlinkError):
56
+ """Raised when the server reports an error in the middle of a streamed response."""
57
+
58
+ def __init__(self, message: str = "Streaming failed"):
59
+ super().__init__(message)
60
+
61
+
62
+ class RateLimited(UnlinkError):
63
+ """Raised when the agent's Rate limit refuses a request (HTTP 429). `retry_after`: in how many seconds one is let through again
64
+ (None: the service did not say)."""
65
+
66
+ def __init__(self, message: str = "Too many requests", retry_after: int = None):
67
+ super().__init__(message, status_code=429)
68
+ self.retry_after = retry_after