quraite 0.0.1__py3-none-any.whl → 0.1.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.
Files changed (48) hide show
  1. quraite/__init__.py +3 -3
  2. quraite/adapters/__init__.py +134 -134
  3. quraite/adapters/agno_adapter.py +159 -159
  4. quraite/adapters/base.py +123 -123
  5. quraite/adapters/bedrock_agents_adapter.py +343 -343
  6. quraite/adapters/flowise_adapter.py +275 -275
  7. quraite/adapters/google_adk_adapter.py +209 -209
  8. quraite/adapters/http_adapter.py +239 -239
  9. quraite/adapters/langflow_adapter.py +192 -192
  10. quraite/adapters/langgraph_adapter.py +304 -304
  11. quraite/adapters/langgraph_server_adapter.py +252 -252
  12. quraite/adapters/n8n_adapter.py +220 -220
  13. quraite/adapters/openai_agents_adapter.py +269 -269
  14. quraite/adapters/pydantic_ai_adapter.py +312 -312
  15. quraite/adapters/smolagents_adapter.py +152 -152
  16. quraite/logger.py +61 -62
  17. quraite/schema/message.py +91 -54
  18. quraite/schema/response.py +16 -16
  19. quraite/serve/__init__.py +1 -1
  20. quraite/serve/cloudflared.py +210 -210
  21. quraite/serve/local_agent.py +360 -360
  22. quraite/tracing/__init__.py +24 -24
  23. quraite/tracing/constants.py +16 -16
  24. quraite/tracing/span_exporter.py +115 -115
  25. quraite/tracing/span_processor.py +49 -49
  26. quraite/tracing/tool_extractors.py +290 -290
  27. quraite/tracing/trace.py +564 -494
  28. quraite/tracing/types.py +179 -179
  29. quraite/tracing/utils.py +170 -170
  30. quraite/utils/json_utils.py +269 -269
  31. {quraite-0.0.1.dist-info → quraite-0.1.0.dist-info}/METADATA +9 -9
  32. quraite-0.1.0.dist-info/RECORD +35 -0
  33. {quraite-0.0.1.dist-info → quraite-0.1.0.dist-info}/WHEEL +1 -1
  34. quraite/traces/traces_adk_openinference.json +0 -379
  35. quraite/traces/traces_agno_multi_agent.json +0 -669
  36. quraite/traces/traces_agno_openinference.json +0 -321
  37. quraite/traces/traces_crewai_openinference.json +0 -155
  38. quraite/traces/traces_langgraph_openinference.json +0 -349
  39. quraite/traces/traces_langgraph_openinference_multi_agent.json +0 -2705
  40. quraite/traces/traces_langgraph_traceloop.json +0 -510
  41. quraite/traces/traces_openai_agents_multi_agent_1.json +0 -402
  42. quraite/traces/traces_openai_agents_openinference.json +0 -341
  43. quraite/traces/traces_pydantic_openinference.json +0 -286
  44. quraite/traces/traces_pydantic_openinference_multi_agent_1.json +0 -399
  45. quraite/traces/traces_pydantic_openinference_multi_agent_2.json +0 -398
  46. quraite/traces/traces_smol_agents_openinference.json +0 -397
  47. quraite/traces/traces_smol_agents_tool_calling_openinference.json +0 -704
  48. quraite-0.0.1.dist-info/RECORD +0 -49
quraite/tracing/types.py CHANGED
@@ -1,179 +1,179 @@
1
- from enum import Enum
2
- from typing import Any
3
-
4
- from pydantic import BaseModel, Field
5
-
6
-
7
- class TraceFlags(BaseModel):
8
- """Serializable trace flags."""
9
-
10
- value: int = 0
11
-
12
- @classmethod
13
- def from_otel(cls, flags: Any | None) -> "TraceFlags":
14
- """Convert from OpenTelemetry TraceFlags."""
15
- if flags is None:
16
- return cls(value=0)
17
- return cls(value=flags.value if hasattr(flags, "value") else 0)
18
-
19
-
20
- class TraceState(BaseModel):
21
- """Serializable trace state."""
22
-
23
- entries: dict[str, str] = Field(default_factory=dict)
24
-
25
- @classmethod
26
- def from_otel(cls, state: Any | None) -> "TraceState":
27
- """Convert from OpenTelemetry TraceState."""
28
- if state is None:
29
- return cls()
30
- return cls(entries=dict(state.items()) if hasattr(state, "items") else {})
31
-
32
-
33
- class SpanKind(str, Enum):
34
- """String-based enum for span kind to make it serializable."""
35
-
36
- INTERNAL = "internal"
37
- SERVER = "server"
38
- CLIENT = "client"
39
- PRODUCER = "producer"
40
- CONSUMER = "consumer"
41
-
42
- @classmethod
43
- def from_otel(cls, kind: Any | None) -> "SpanKind":
44
- """Convert from OpenTelemetry SpanKind."""
45
- if kind is None:
46
- return cls.INTERNAL
47
-
48
- mapping = {
49
- 0: cls.INTERNAL,
50
- 1: cls.SERVER,
51
- 2: cls.CLIENT,
52
- 3: cls.PRODUCER,
53
- 4: cls.CONSUMER,
54
- }
55
- return mapping.get(kind.value, cls.INTERNAL)
56
-
57
-
58
- class SpanContext(BaseModel):
59
- """Serializable span context."""
60
-
61
- trace_id: int | None = None
62
- span_id: int | None = None
63
- is_remote: bool = False
64
- trace_flags: TraceFlags = Field(default_factory=TraceFlags)
65
- trace_state: TraceState = Field(default_factory=TraceState)
66
-
67
- @classmethod
68
- def from_otel(cls, context: Any | None) -> "SpanContext":
69
- """Convert from OpenTelemetry SpanContext."""
70
- if context is None:
71
- return cls()
72
-
73
- return cls(
74
- trace_id=getattr(context, "trace_id", None),
75
- span_id=getattr(context, "span_id", None),
76
- is_remote=getattr(context, "is_remote", False),
77
- trace_flags=TraceFlags.from_otel(getattr(context, "trace_flags", None)),
78
- trace_state=TraceState.from_otel(getattr(context, "trace_state", None)),
79
- )
80
-
81
-
82
- class StatusCode(str, Enum):
83
- """String-based enum for status code to make it serializable."""
84
-
85
- UNSET = "unset"
86
- OK = "ok"
87
- ERROR = "error"
88
-
89
- @classmethod
90
- def from_otel(cls, code: Any | None) -> "StatusCode":
91
- """Convert from OpenTelemetry StatusCode."""
92
- if code is None:
93
- return cls.UNSET
94
-
95
- mapping = {"UNSET": cls.UNSET, "OK": cls.OK, "ERROR": cls.ERROR}
96
-
97
- if hasattr(code, "name"):
98
- return mapping.get(code.name, cls.UNSET)
99
- return cls.UNSET
100
-
101
-
102
- class Status(BaseModel):
103
- """Serializable status."""
104
-
105
- status_code: StatusCode = StatusCode.UNSET
106
- description: str | None = None
107
-
108
- @classmethod
109
- def from_otel(cls, status: Any | None) -> "Status":
110
- """Convert from OpenTelemetry Status."""
111
- if status is None:
112
- return cls()
113
-
114
- return cls(
115
- status_code=StatusCode.from_otel(getattr(status, "status_code", None)),
116
- description=getattr(status, "description", ""),
117
- )
118
-
119
-
120
- class AttributeValue(BaseModel):
121
- """A wrapper for attribute values that can be serialized."""
122
-
123
- value: str | int | float | bool | list[str | int | float | bool]
124
-
125
-
126
- class Link(BaseModel):
127
- """Serializable link."""
128
-
129
- context: SpanContext
130
- attributes: dict[str, Any] | None = None
131
-
132
- @classmethod
133
- def from_otel(cls, link: Any | None) -> "Link":
134
- """Convert from OpenTelemetry Link."""
135
- if link is None:
136
- return cls(context=SpanContext())
137
-
138
- return cls(
139
- context=SpanContext.from_otel(getattr(link, "context", None)),
140
- attributes=getattr(link, "attributes", None),
141
- )
142
-
143
-
144
- class Event(BaseModel):
145
- """Serializable event."""
146
-
147
- name: str
148
- timestamp: int = 0
149
- attributes: dict[str, Any] | None = None
150
-
151
- @classmethod
152
- def from_otel(cls, event: Any | None) -> "Event":
153
- """Convert from OpenTelemetry Event."""
154
- if event is None:
155
- return cls(name="")
156
-
157
- return cls(
158
- name=getattr(event, "name", ""),
159
- timestamp=getattr(event, "timestamp", 0),
160
- attributes=getattr(event, "attributes", None),
161
- )
162
-
163
-
164
- class Resource(BaseModel):
165
- """Serializable resource."""
166
-
167
- attributes: dict[str, Any] = Field(default_factory=dict)
168
- schema_url: str = ""
169
-
170
- @classmethod
171
- def from_otel(cls, resource: Any | None) -> "Resource":
172
- """Convert from OpenTelemetry Resource."""
173
- if resource is None:
174
- return cls()
175
-
176
- return cls(
177
- attributes=getattr(resource, "attributes", {}),
178
- schema_url=getattr(resource, "schema_url", ""),
179
- )
1
+ from enum import Enum
2
+ from typing import Any
3
+
4
+ from pydantic import BaseModel, Field
5
+
6
+
7
+ class TraceFlags(BaseModel):
8
+ """Serializable trace flags."""
9
+
10
+ value: int = 0
11
+
12
+ @classmethod
13
+ def from_otel(cls, flags: Any | None) -> "TraceFlags":
14
+ """Convert from OpenTelemetry TraceFlags."""
15
+ if flags is None:
16
+ return cls(value=0)
17
+ return cls(value=flags.value if hasattr(flags, "value") else 0)
18
+
19
+
20
+ class TraceState(BaseModel):
21
+ """Serializable trace state."""
22
+
23
+ entries: dict[str, str] = Field(default_factory=dict)
24
+
25
+ @classmethod
26
+ def from_otel(cls, state: Any | None) -> "TraceState":
27
+ """Convert from OpenTelemetry TraceState."""
28
+ if state is None:
29
+ return cls()
30
+ return cls(entries=dict(state.items()) if hasattr(state, "items") else {})
31
+
32
+
33
+ class SpanKind(str, Enum):
34
+ """String-based enum for span kind to make it serializable."""
35
+
36
+ INTERNAL = "internal"
37
+ SERVER = "server"
38
+ CLIENT = "client"
39
+ PRODUCER = "producer"
40
+ CONSUMER = "consumer"
41
+
42
+ @classmethod
43
+ def from_otel(cls, kind: Any | None) -> "SpanKind":
44
+ """Convert from OpenTelemetry SpanKind."""
45
+ if kind is None:
46
+ return cls.INTERNAL
47
+
48
+ mapping = {
49
+ 0: cls.INTERNAL,
50
+ 1: cls.SERVER,
51
+ 2: cls.CLIENT,
52
+ 3: cls.PRODUCER,
53
+ 4: cls.CONSUMER,
54
+ }
55
+ return mapping.get(kind.value, cls.INTERNAL)
56
+
57
+
58
+ class SpanContext(BaseModel):
59
+ """Serializable span context."""
60
+
61
+ trace_id: int | None = None
62
+ span_id: int | None = None
63
+ is_remote: bool = False
64
+ trace_flags: TraceFlags = Field(default_factory=TraceFlags)
65
+ trace_state: TraceState = Field(default_factory=TraceState)
66
+
67
+ @classmethod
68
+ def from_otel(cls, context: Any | None) -> "SpanContext":
69
+ """Convert from OpenTelemetry SpanContext."""
70
+ if context is None:
71
+ return cls()
72
+
73
+ return cls(
74
+ trace_id=getattr(context, "trace_id", None),
75
+ span_id=getattr(context, "span_id", None),
76
+ is_remote=getattr(context, "is_remote", False),
77
+ trace_flags=TraceFlags.from_otel(getattr(context, "trace_flags", None)),
78
+ trace_state=TraceState.from_otel(getattr(context, "trace_state", None)),
79
+ )
80
+
81
+
82
+ class StatusCode(str, Enum):
83
+ """String-based enum for status code to make it serializable."""
84
+
85
+ UNSET = "unset"
86
+ OK = "ok"
87
+ ERROR = "error"
88
+
89
+ @classmethod
90
+ def from_otel(cls, code: Any | None) -> "StatusCode":
91
+ """Convert from OpenTelemetry StatusCode."""
92
+ if code is None:
93
+ return cls.UNSET
94
+
95
+ mapping = {"UNSET": cls.UNSET, "OK": cls.OK, "ERROR": cls.ERROR}
96
+
97
+ if hasattr(code, "name"):
98
+ return mapping.get(code.name, cls.UNSET)
99
+ return cls.UNSET
100
+
101
+
102
+ class Status(BaseModel):
103
+ """Serializable status."""
104
+
105
+ status_code: StatusCode = StatusCode.UNSET
106
+ description: str | None = None
107
+
108
+ @classmethod
109
+ def from_otel(cls, status: Any | None) -> "Status":
110
+ """Convert from OpenTelemetry Status."""
111
+ if status is None:
112
+ return cls()
113
+
114
+ return cls(
115
+ status_code=StatusCode.from_otel(getattr(status, "status_code", None)),
116
+ description=getattr(status, "description", ""),
117
+ )
118
+
119
+
120
+ class AttributeValue(BaseModel):
121
+ """A wrapper for attribute values that can be serialized."""
122
+
123
+ value: str | int | float | bool | list[str | int | float | bool]
124
+
125
+
126
+ class Link(BaseModel):
127
+ """Serializable link."""
128
+
129
+ context: SpanContext
130
+ attributes: dict[str, Any] | None = None
131
+
132
+ @classmethod
133
+ def from_otel(cls, link: Any | None) -> "Link":
134
+ """Convert from OpenTelemetry Link."""
135
+ if link is None:
136
+ return cls(context=SpanContext())
137
+
138
+ return cls(
139
+ context=SpanContext.from_otel(getattr(link, "context", None)),
140
+ attributes=getattr(link, "attributes", None),
141
+ )
142
+
143
+
144
+ class Event(BaseModel):
145
+ """Serializable event."""
146
+
147
+ name: str
148
+ timestamp: int = 0
149
+ attributes: dict[str, Any] | None = None
150
+
151
+ @classmethod
152
+ def from_otel(cls, event: Any | None) -> "Event":
153
+ """Convert from OpenTelemetry Event."""
154
+ if event is None:
155
+ return cls(name="")
156
+
157
+ return cls(
158
+ name=getattr(event, "name", ""),
159
+ timestamp=getattr(event, "timestamp", 0),
160
+ attributes=getattr(event, "attributes", None),
161
+ )
162
+
163
+
164
+ class Resource(BaseModel):
165
+ """Serializable resource."""
166
+
167
+ attributes: dict[str, Any] = Field(default_factory=dict)
168
+ schema_url: str = ""
169
+
170
+ @classmethod
171
+ def from_otel(cls, resource: Any | None) -> "Resource":
172
+ """Convert from OpenTelemetry Resource."""
173
+ if resource is None:
174
+ return cls()
175
+
176
+ return cls(
177
+ attributes=getattr(resource, "attributes", {}),
178
+ schema_url=getattr(resource, "schema_url", ""),
179
+ )