quraite 0.1.0__py3-none-any.whl → 0.1.2__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 (49) hide show
  1. quraite/__init__.py +3 -3
  2. quraite/adapters/__init__.py +134 -134
  3. quraite/adapters/agno_adapter.py +157 -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 +211 -209
  8. quraite/adapters/http_adapter.py +255 -239
  9. quraite/adapters/{langgraph_adapter.py → langchain_adapter.py} +305 -304
  10. quraite/adapters/{langgraph_server_adapter.py → langchain_server_adapter.py} +252 -252
  11. quraite/adapters/langflow_adapter.py +192 -192
  12. quraite/adapters/n8n_adapter.py +220 -220
  13. quraite/adapters/openai_agents_adapter.py +267 -269
  14. quraite/adapters/pydantic_ai_adapter.py +307 -312
  15. quraite/adapters/smolagents_adapter.py +148 -152
  16. quraite/logger.py +61 -61
  17. quraite/schema/message.py +91 -91
  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/traces/traces_adk_openinference.json +379 -0
  23. quraite/traces/traces_agno_multi_agent.json +669 -0
  24. quraite/traces/traces_agno_openinference.json +321 -0
  25. quraite/traces/traces_crewai_openinference.json +155 -0
  26. quraite/traces/traces_langgraph_openinference.json +349 -0
  27. quraite/traces/traces_langgraph_openinference_multi_agent.json +2705 -0
  28. quraite/traces/traces_langgraph_traceloop.json +510 -0
  29. quraite/traces/traces_openai_agents_multi_agent_1.json +402 -0
  30. quraite/traces/traces_openai_agents_openinference.json +341 -0
  31. quraite/traces/traces_pydantic_openinference.json +286 -0
  32. quraite/traces/traces_pydantic_openinference_multi_agent_1.json +399 -0
  33. quraite/traces/traces_pydantic_openinference_multi_agent_2.json +398 -0
  34. quraite/traces/traces_smol_agents_openinference.json +397 -0
  35. quraite/traces/traces_smol_agents_tool_calling_openinference.json +704 -0
  36. quraite/tracing/__init__.py +25 -24
  37. quraite/tracing/constants.py +15 -16
  38. quraite/tracing/span_exporter.py +101 -115
  39. quraite/tracing/span_processor.py +47 -49
  40. quraite/tracing/tool_extractors.py +309 -290
  41. quraite/tracing/trace.py +564 -564
  42. quraite/tracing/types.py +179 -179
  43. quraite/tracing/utils.py +170 -170
  44. quraite/utils/json_utils.py +269 -269
  45. quraite-0.1.2.dist-info/METADATA +386 -0
  46. quraite-0.1.2.dist-info/RECORD +49 -0
  47. {quraite-0.1.0.dist-info → quraite-0.1.2.dist-info}/WHEEL +1 -1
  48. quraite-0.1.0.dist-info/METADATA +0 -44
  49. quraite-0.1.0.dist-info/RECORD +0 -35
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
+ )