cetra-sdk 0.1.0rc1__tar.gz
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.
- cetra_sdk-0.1.0rc1/LICENSE +21 -0
- cetra_sdk-0.1.0rc1/PKG-INFO +133 -0
- cetra_sdk-0.1.0rc1/README.md +74 -0
- cetra_sdk-0.1.0rc1/pyproject.toml +123 -0
- cetra_sdk-0.1.0rc1/pyproject.toml.orig +100 -0
- cetra_sdk-0.1.0rc1/src/cetra/__init__.py +71 -0
- cetra_sdk-0.1.0rc1/src/cetra/_annotation_queues.py +333 -0
- cetra_sdk-0.1.0rc1/src/cetra/_client.py +216 -0
- cetra_sdk-0.1.0rc1/src/cetra/_config.py +313 -0
- cetra_sdk-0.1.0rc1/src/cetra/_context.py +231 -0
- cetra_sdk-0.1.0rc1/src/cetra/_datasets.py +203 -0
- cetra_sdk-0.1.0rc1/src/cetra/_experiments.py +874 -0
- cetra_sdk-0.1.0rc1/src/cetra/_filter.py +44 -0
- cetra_sdk-0.1.0rc1/src/cetra/_generators.py +467 -0
- cetra_sdk-0.1.0rc1/src/cetra/_instrument.py +173 -0
- cetra_sdk-0.1.0rc1/src/cetra/_llm.py +293 -0
- cetra_sdk-0.1.0rc1/src/cetra/_log.py +30 -0
- cetra_sdk-0.1.0rc1/src/cetra/_mask.py +196 -0
- cetra_sdk-0.1.0rc1/src/cetra/_processor.py +142 -0
- cetra_sdk-0.1.0rc1/src/cetra/_prompts.py +701 -0
- cetra_sdk-0.1.0rc1/src/cetra/_quota.py +121 -0
- cetra_sdk-0.1.0rc1/src/cetra/_retry.py +26 -0
- cetra_sdk-0.1.0rc1/src/cetra/_runtime.py +296 -0
- cetra_sdk-0.1.0rc1/src/cetra/_scores.py +500 -0
- cetra_sdk-0.1.0rc1/src/cetra/_serialize.py +197 -0
- cetra_sdk-0.1.0rc1/src/cetra/_spans.py +595 -0
- cetra_sdk-0.1.0rc1/src/cetra/_template.py +236 -0
- cetra_sdk-0.1.0rc1/src/cetra/py.typed +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sebastiencs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cetra-sdk
|
|
3
|
+
Version: 0.1.0rc1
|
|
4
|
+
Summary: Python SDK for the cetra observability server.
|
|
5
|
+
Keywords: llm,observability,opentelemetry,tracing,evaluation
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Topic :: System :: Monitoring
|
|
17
|
+
Requires-Dist: opentelemetry-api>=1.45.2,<2
|
|
18
|
+
Requires-Dist: opentelemetry-sdk>=1.45.2,<2
|
|
19
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.45.2,<2
|
|
20
|
+
Requires-Dist: requests>=2.32
|
|
21
|
+
Requires-Dist: openinference-instrumentation-openai>=0.1.69 ; extra == 'all'
|
|
22
|
+
Requires-Dist: openinference-instrumentation-anthropic>=3.3.0 ; extra == 'all'
|
|
23
|
+
Requires-Dist: openinference-instrumentation-langchain>=0.1.82 ; extra == 'all'
|
|
24
|
+
Requires-Dist: openinference-instrumentation-llama-index>=4.7.1 ; extra == 'all'
|
|
25
|
+
Requires-Dist: openinference-instrumentation-litellm>=0.1.53 ; extra == 'all'
|
|
26
|
+
Requires-Dist: openinference-instrumentation-google-genai>=1.5.1 ; extra == 'all'
|
|
27
|
+
Requires-Dist: openinference-instrumentation-bedrock>=0.1.63 ; extra == 'all'
|
|
28
|
+
Requires-Dist: openinference-instrumentation-openai-agents>=2.7.1 ; extra == 'all'
|
|
29
|
+
Requires-Dist: openinference-instrumentation-crewai>=1.1.23 ; extra == 'all'
|
|
30
|
+
Requires-Dist: openinference-instrumentation-dspy>=0.1.50 ; extra == 'all'
|
|
31
|
+
Requires-Dist: openinference-instrumentation-anthropic>=3.3.0 ; extra == 'anthropic'
|
|
32
|
+
Requires-Dist: openinference-instrumentation-bedrock>=0.1.63 ; extra == 'bedrock'
|
|
33
|
+
Requires-Dist: openinference-instrumentation-crewai>=1.1.23 ; extra == 'crewai'
|
|
34
|
+
Requires-Dist: openinference-instrumentation-dspy>=0.1.50 ; extra == 'dspy'
|
|
35
|
+
Requires-Dist: openinference-instrumentation-google-genai>=1.5.1 ; extra == 'google-genai'
|
|
36
|
+
Requires-Dist: openinference-instrumentation-langchain>=0.1.82 ; extra == 'langchain'
|
|
37
|
+
Requires-Dist: openinference-instrumentation-litellm>=0.1.53 ; extra == 'litellm'
|
|
38
|
+
Requires-Dist: openinference-instrumentation-llama-index>=4.7.1 ; extra == 'llama-index'
|
|
39
|
+
Requires-Dist: openinference-instrumentation-openai>=0.1.69 ; extra == 'openai'
|
|
40
|
+
Requires-Dist: openinference-instrumentation-openai-agents>=2.7.1 ; extra == 'openai-agents'
|
|
41
|
+
Requires-Python: >=3.11
|
|
42
|
+
Project-URL: Homepage, https://cetra.sh
|
|
43
|
+
Project-URL: Documentation, https://cetra.sh/docs/reference/python/
|
|
44
|
+
Project-URL: Repository, https://github.com/cetra-ai/cetra
|
|
45
|
+
Project-URL: Issues, https://github.com/cetra-ai/cetra/issues
|
|
46
|
+
Project-URL: Changelog, https://github.com/cetra-ai/cetra/blob/main/CHANGELOG.md
|
|
47
|
+
Provides-Extra: all
|
|
48
|
+
Provides-Extra: anthropic
|
|
49
|
+
Provides-Extra: bedrock
|
|
50
|
+
Provides-Extra: crewai
|
|
51
|
+
Provides-Extra: dspy
|
|
52
|
+
Provides-Extra: google-genai
|
|
53
|
+
Provides-Extra: langchain
|
|
54
|
+
Provides-Extra: litellm
|
|
55
|
+
Provides-Extra: llama-index
|
|
56
|
+
Provides-Extra: openai
|
|
57
|
+
Provides-Extra: openai-agents
|
|
58
|
+
Description-Content-Type: text/markdown
|
|
59
|
+
|
|
60
|
+
# Python SDK
|
|
61
|
+
|
|
62
|
+
`cetra` is the Python SDK for cetra, the single-binary LLM observability
|
|
63
|
+
server. It is a thin layer over OpenTelemetry: spans go out as OTLP/HTTP
|
|
64
|
+
protobuf to `<base_url>/v1/traces`, and scores go to
|
|
65
|
+
`<base_url>/api/v1/scores`. Python >= 3.11. MIT.
|
|
66
|
+
|
|
67
|
+
The server stores traces only. If another OpenTelemetry GenAI instrumentation sends prompts
|
|
68
|
+
and completions as log events, they reach `/v1/logs` and are dropped; the project shows a hint
|
|
69
|
+
in the UI. Set that instrumentation to capture message content on spans.
|
|
70
|
+
|
|
71
|
+
## Install
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install cetra-sdk
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Auto-instrumentation is optional, one extra per library:
|
|
78
|
+
|
|
79
|
+
| `instrument` name | Extra |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `openai` | `cetra-sdk[openai]` |
|
|
82
|
+
| `anthropic` | `cetra-sdk[anthropic]` |
|
|
83
|
+
| `langchain` | `cetra-sdk[langchain]` |
|
|
84
|
+
| `llama-index` | `cetra-sdk[llama-index]` |
|
|
85
|
+
| `litellm` | `cetra-sdk[litellm]` |
|
|
86
|
+
| `google-genai` | `cetra-sdk[google-genai]` |
|
|
87
|
+
| `bedrock` | `cetra-sdk[bedrock]` |
|
|
88
|
+
| `openai-agents` | `cetra-sdk[openai-agents]` |
|
|
89
|
+
| `crewai` | `cetra-sdk[crewai]` |
|
|
90
|
+
| `dspy` | `cetra-sdk[dspy]` |
|
|
91
|
+
|
|
92
|
+
`cetra-sdk[all]` installs every instrumentor. The core package pulls in only
|
|
93
|
+
`opentelemetry-api`, `opentelemetry-sdk`, `opentelemetry-exporter-otlp-proto-http`
|
|
94
|
+
and `requests`.
|
|
95
|
+
|
|
96
|
+
## Quick start
|
|
97
|
+
|
|
98
|
+
<!-- test -->
|
|
99
|
+
```python
|
|
100
|
+
import cetra
|
|
101
|
+
|
|
102
|
+
cetra.init(api_key="sk-cetra-test")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@cetra.observe(kind="tool", name="search_docs")
|
|
106
|
+
def search_docs(query: str, limit: int = 2) -> list[str]:
|
|
107
|
+
return ["doc-1", "doc-2"]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@cetra.observe(name="answer")
|
|
111
|
+
def answer(question: str) -> str:
|
|
112
|
+
docs = search_docs(question)
|
|
113
|
+
return f"It is in {docs[0]}."
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
answer("why?")
|
|
117
|
+
|
|
118
|
+
cetra.flush() # blocks until spans (and scores) are exported
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`init()` is called once per process; it also registers an `atexit` hook that
|
|
122
|
+
calls `shutdown()` (flush, then stop). `flush()` is the manual lever when you
|
|
123
|
+
need the data out now — see [Serverless](https://cetra.sh/docs/reference/python/opentelemetry/#serverless).
|
|
124
|
+
|
|
125
|
+
Without an API key (argument and `CETRA_API_KEY` both unset), `init()` logs
|
|
126
|
+
one warning — `cetra: no API key; set CETRA_API_KEY, or CETRA_ENABLED=false
|
|
127
|
+
to silence this; tracing is disabled` — and the SDK runs as a no-op: nothing
|
|
128
|
+
raises, nothing is sent. Set `CETRA_ENABLED=false` to silence the warning.
|
|
129
|
+
|
|
130
|
+
## Documentation
|
|
131
|
+
|
|
132
|
+
The full guide and reference are at https://cetra.sh/docs/reference/python/ (configuration,
|
|
133
|
+
tracing, context, scores, datasets and experiments, OpenTelemetry, the API).
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Python SDK
|
|
2
|
+
|
|
3
|
+
`cetra` is the Python SDK for cetra, the single-binary LLM observability
|
|
4
|
+
server. It is a thin layer over OpenTelemetry: spans go out as OTLP/HTTP
|
|
5
|
+
protobuf to `<base_url>/v1/traces`, and scores go to
|
|
6
|
+
`<base_url>/api/v1/scores`. Python >= 3.11. MIT.
|
|
7
|
+
|
|
8
|
+
The server stores traces only. If another OpenTelemetry GenAI instrumentation sends prompts
|
|
9
|
+
and completions as log events, they reach `/v1/logs` and are dropped; the project shows a hint
|
|
10
|
+
in the UI. Set that instrumentation to capture message content on spans.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install cetra-sdk
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Auto-instrumentation is optional, one extra per library:
|
|
19
|
+
|
|
20
|
+
| `instrument` name | Extra |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `openai` | `cetra-sdk[openai]` |
|
|
23
|
+
| `anthropic` | `cetra-sdk[anthropic]` |
|
|
24
|
+
| `langchain` | `cetra-sdk[langchain]` |
|
|
25
|
+
| `llama-index` | `cetra-sdk[llama-index]` |
|
|
26
|
+
| `litellm` | `cetra-sdk[litellm]` |
|
|
27
|
+
| `google-genai` | `cetra-sdk[google-genai]` |
|
|
28
|
+
| `bedrock` | `cetra-sdk[bedrock]` |
|
|
29
|
+
| `openai-agents` | `cetra-sdk[openai-agents]` |
|
|
30
|
+
| `crewai` | `cetra-sdk[crewai]` |
|
|
31
|
+
| `dspy` | `cetra-sdk[dspy]` |
|
|
32
|
+
|
|
33
|
+
`cetra-sdk[all]` installs every instrumentor. The core package pulls in only
|
|
34
|
+
`opentelemetry-api`, `opentelemetry-sdk`, `opentelemetry-exporter-otlp-proto-http`
|
|
35
|
+
and `requests`.
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
<!-- test -->
|
|
40
|
+
```python
|
|
41
|
+
import cetra
|
|
42
|
+
|
|
43
|
+
cetra.init(api_key="sk-cetra-test")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@cetra.observe(kind="tool", name="search_docs")
|
|
47
|
+
def search_docs(query: str, limit: int = 2) -> list[str]:
|
|
48
|
+
return ["doc-1", "doc-2"]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@cetra.observe(name="answer")
|
|
52
|
+
def answer(question: str) -> str:
|
|
53
|
+
docs = search_docs(question)
|
|
54
|
+
return f"It is in {docs[0]}."
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
answer("why?")
|
|
58
|
+
|
|
59
|
+
cetra.flush() # blocks until spans (and scores) are exported
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`init()` is called once per process; it also registers an `atexit` hook that
|
|
63
|
+
calls `shutdown()` (flush, then stop). `flush()` is the manual lever when you
|
|
64
|
+
need the data out now — see [Serverless](https://cetra.sh/docs/reference/python/opentelemetry/#serverless).
|
|
65
|
+
|
|
66
|
+
Without an API key (argument and `CETRA_API_KEY` both unset), `init()` logs
|
|
67
|
+
one warning — `cetra: no API key; set CETRA_API_KEY, or CETRA_ENABLED=false
|
|
68
|
+
to silence this; tracing is disabled` — and the SDK runs as a no-op: nothing
|
|
69
|
+
raises, nothing is sent. Set `CETRA_ENABLED=false` to silence the warning.
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
The full guide and reference are at https://cetra.sh/docs/reference/python/ (configuration,
|
|
74
|
+
tracing, context, scores, datasets and experiments, OpenTelemetry, the API).
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cetra-sdk"
|
|
3
|
+
version = "0.1.0rc1"
|
|
4
|
+
description = "Python SDK for the cetra observability server."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"opentelemetry-api>=1.45.2,<2",
|
|
11
|
+
"opentelemetry-sdk>=1.45.2,<2",
|
|
12
|
+
"opentelemetry-exporter-otlp-proto-http>=1.45.2,<2",
|
|
13
|
+
"requests>=2.32",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3.15",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
"Development Status :: 3 - Alpha",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"Topic :: System :: Monitoring",
|
|
25
|
+
]
|
|
26
|
+
keywords = [
|
|
27
|
+
"llm",
|
|
28
|
+
"observability",
|
|
29
|
+
"opentelemetry",
|
|
30
|
+
"tracing",
|
|
31
|
+
"evaluation",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://cetra.sh"
|
|
36
|
+
Documentation = "https://cetra.sh/docs/reference/python/"
|
|
37
|
+
Repository = "https://github.com/cetra-ai/cetra"
|
|
38
|
+
Issues = "https://github.com/cetra-ai/cetra/issues"
|
|
39
|
+
Changelog = "https://github.com/cetra-ai/cetra/blob/main/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
openai = ["openinference-instrumentation-openai>=0.1.69"]
|
|
43
|
+
anthropic = ["openinference-instrumentation-anthropic>=3.3.0"]
|
|
44
|
+
langchain = ["openinference-instrumentation-langchain>=0.1.82"]
|
|
45
|
+
llama-index = ["openinference-instrumentation-llama-index>=4.7.1"]
|
|
46
|
+
litellm = ["openinference-instrumentation-litellm>=0.1.53"]
|
|
47
|
+
google-genai = ["openinference-instrumentation-google-genai>=1.5.1"]
|
|
48
|
+
bedrock = ["openinference-instrumentation-bedrock>=0.1.63"]
|
|
49
|
+
openai-agents = ["openinference-instrumentation-openai-agents>=2.7.1"]
|
|
50
|
+
crewai = ["openinference-instrumentation-crewai>=1.1.23"]
|
|
51
|
+
dspy = ["openinference-instrumentation-dspy>=0.1.50"]
|
|
52
|
+
all = [
|
|
53
|
+
"openinference-instrumentation-openai>=0.1.69",
|
|
54
|
+
"openinference-instrumentation-anthropic>=3.3.0",
|
|
55
|
+
"openinference-instrumentation-langchain>=0.1.82",
|
|
56
|
+
"openinference-instrumentation-llama-index>=4.7.1",
|
|
57
|
+
"openinference-instrumentation-litellm>=0.1.53",
|
|
58
|
+
"openinference-instrumentation-google-genai>=1.5.1",
|
|
59
|
+
"openinference-instrumentation-bedrock>=0.1.63",
|
|
60
|
+
"openinference-instrumentation-openai-agents>=2.7.1",
|
|
61
|
+
"openinference-instrumentation-crewai>=1.1.23",
|
|
62
|
+
"openinference-instrumentation-dspy>=0.1.50",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[build-system]
|
|
66
|
+
requires = ["uv_build>=0.13.6,<0.14"]
|
|
67
|
+
build-backend = "uv_build"
|
|
68
|
+
|
|
69
|
+
[tool.uv.build-backend]
|
|
70
|
+
module-name = "cetra"
|
|
71
|
+
|
|
72
|
+
[tool.ruff]
|
|
73
|
+
target-version = "py311"
|
|
74
|
+
line-length = 100
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
select = [
|
|
78
|
+
"E",
|
|
79
|
+
"W",
|
|
80
|
+
"F",
|
|
81
|
+
"I",
|
|
82
|
+
"B",
|
|
83
|
+
"UP",
|
|
84
|
+
"SIM",
|
|
85
|
+
"RUF",
|
|
86
|
+
"PT",
|
|
87
|
+
"ANN",
|
|
88
|
+
"S",
|
|
89
|
+
"BLE",
|
|
90
|
+
"N",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint.per-file-ignores]
|
|
94
|
+
"tests/**" = ["S101"]
|
|
95
|
+
|
|
96
|
+
[tool.mypy]
|
|
97
|
+
strict = true
|
|
98
|
+
python_version = "3.11"
|
|
99
|
+
files = [
|
|
100
|
+
"src",
|
|
101
|
+
"tests",
|
|
102
|
+
]
|
|
103
|
+
mypy_path = "src"
|
|
104
|
+
|
|
105
|
+
[tool.pytest.ini_options]
|
|
106
|
+
testpaths = ["tests"]
|
|
107
|
+
addopts = "-ra --strict-markers --strict-config"
|
|
108
|
+
markers = ["e2e: needs a running cetra serve (just e2e)"]
|
|
109
|
+
xfail_strict = true
|
|
110
|
+
filterwarnings = ["error"]
|
|
111
|
+
|
|
112
|
+
[dependency-groups]
|
|
113
|
+
dev = [
|
|
114
|
+
"ruff>=0.17.3",
|
|
115
|
+
"mypy>=2.4.1",
|
|
116
|
+
"pytest>=9.2.0",
|
|
117
|
+
"types-protobuf>=7.35.1.20260906",
|
|
118
|
+
"types-requests>=2.33.0.20261030",
|
|
119
|
+
"openinference-instrumentation-openai>=0.1.69",
|
|
120
|
+
"openinference-instrumentation-anthropic>=3.3.0",
|
|
121
|
+
"openai>=2",
|
|
122
|
+
"anthropic>=0.70",
|
|
123
|
+
]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cetra-sdk"
|
|
3
|
+
version = "0.1.0rc1"
|
|
4
|
+
description = "Python SDK for the cetra observability server."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"opentelemetry-api>=1.45.2,<2",
|
|
11
|
+
"opentelemetry-sdk>=1.45.2,<2",
|
|
12
|
+
"opentelemetry-exporter-otlp-proto-http>=1.45.2,<2",
|
|
13
|
+
"requests>=2.32",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3.15",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
"Development Status :: 3 - Alpha",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"Topic :: System :: Monitoring",
|
|
25
|
+
]
|
|
26
|
+
keywords = ["llm", "observability", "opentelemetry", "tracing", "evaluation"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://cetra.sh"
|
|
30
|
+
Documentation = "https://cetra.sh/docs/reference/python/"
|
|
31
|
+
Repository = "https://github.com/cetra-ai/cetra"
|
|
32
|
+
Issues = "https://github.com/cetra-ai/cetra/issues"
|
|
33
|
+
Changelog = "https://github.com/cetra-ai/cetra/blob/main/CHANGELOG.md"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
openai = ["openinference-instrumentation-openai>=0.1.69"]
|
|
37
|
+
anthropic = ["openinference-instrumentation-anthropic>=3.3.0"]
|
|
38
|
+
langchain = ["openinference-instrumentation-langchain>=0.1.82"]
|
|
39
|
+
llama-index = ["openinference-instrumentation-llama-index>=4.7.1"]
|
|
40
|
+
litellm = ["openinference-instrumentation-litellm>=0.1.53"]
|
|
41
|
+
google-genai = ["openinference-instrumentation-google-genai>=1.5.1"]
|
|
42
|
+
bedrock = ["openinference-instrumentation-bedrock>=0.1.63"]
|
|
43
|
+
openai-agents = ["openinference-instrumentation-openai-agents>=2.7.1"]
|
|
44
|
+
crewai = ["openinference-instrumentation-crewai>=1.1.23"]
|
|
45
|
+
dspy = ["openinference-instrumentation-dspy>=0.1.50"]
|
|
46
|
+
all = [
|
|
47
|
+
"openinference-instrumentation-openai>=0.1.69",
|
|
48
|
+
"openinference-instrumentation-anthropic>=3.3.0",
|
|
49
|
+
"openinference-instrumentation-langchain>=0.1.82",
|
|
50
|
+
"openinference-instrumentation-llama-index>=4.7.1",
|
|
51
|
+
"openinference-instrumentation-litellm>=0.1.53",
|
|
52
|
+
"openinference-instrumentation-google-genai>=1.5.1",
|
|
53
|
+
"openinference-instrumentation-bedrock>=0.1.63",
|
|
54
|
+
"openinference-instrumentation-openai-agents>=2.7.1",
|
|
55
|
+
"openinference-instrumentation-crewai>=1.1.23",
|
|
56
|
+
"openinference-instrumentation-dspy>=0.1.50",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["uv_build>=0.13.6,<0.14"]
|
|
61
|
+
build-backend = "uv_build"
|
|
62
|
+
|
|
63
|
+
[tool.uv.build-backend]
|
|
64
|
+
module-name = "cetra"
|
|
65
|
+
|
|
66
|
+
[dependency-groups]
|
|
67
|
+
dev = [
|
|
68
|
+
"ruff>=0.17.3",
|
|
69
|
+
"mypy>=2.4.1",
|
|
70
|
+
"pytest>=9.2.0",
|
|
71
|
+
"types-protobuf>=7.35.1.20260906",
|
|
72
|
+
"types-requests>=2.33.0.20261030",
|
|
73
|
+
"openinference-instrumentation-openai>=0.1.69",
|
|
74
|
+
"openinference-instrumentation-anthropic>=3.3.0",
|
|
75
|
+
"openai>=2",
|
|
76
|
+
"anthropic>=0.70",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff]
|
|
80
|
+
target-version = "py311"
|
|
81
|
+
line-length = 100
|
|
82
|
+
|
|
83
|
+
[tool.ruff.lint]
|
|
84
|
+
select = ["E", "W", "F", "I", "B", "UP", "SIM", "RUF", "PT", "ANN", "S", "BLE", "N"]
|
|
85
|
+
|
|
86
|
+
[tool.ruff.lint.per-file-ignores]
|
|
87
|
+
"tests/**" = ["S101"]
|
|
88
|
+
|
|
89
|
+
[tool.mypy]
|
|
90
|
+
strict = true
|
|
91
|
+
python_version = "3.11"
|
|
92
|
+
files = ["src", "tests"]
|
|
93
|
+
mypy_path = "src"
|
|
94
|
+
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
testpaths = ["tests"]
|
|
97
|
+
addopts = "-ra --strict-markers --strict-config"
|
|
98
|
+
markers = ["e2e: needs a running cetra serve (just e2e)"]
|
|
99
|
+
xfail_strict = true
|
|
100
|
+
filterwarnings = ["error"]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Python SDK for cetra.
|
|
2
|
+
|
|
3
|
+
Tracing, scores and configuration follow ``docs/spec/10-sdk.md``.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import importlib.metadata
|
|
7
|
+
|
|
8
|
+
# __version__ is set before the submodule imports: _runtime imports it from here.
|
|
9
|
+
__version__ = importlib.metadata.version("cetra-sdk")
|
|
10
|
+
|
|
11
|
+
from cetra._annotation_queues import (
|
|
12
|
+
AddedQueueItems,
|
|
13
|
+
AnnotationQueue,
|
|
14
|
+
AnnotationQueueItem,
|
|
15
|
+
QueueCounts,
|
|
16
|
+
QueueItemStatus,
|
|
17
|
+
QueueTarget,
|
|
18
|
+
SkippedQueueItem,
|
|
19
|
+
)
|
|
20
|
+
from cetra._client import ApiError, Client
|
|
21
|
+
from cetra._config import ConfigError
|
|
22
|
+
from cetra._context import context
|
|
23
|
+
from cetra._datasets import Dataset, DatasetInfo, DatasetItem
|
|
24
|
+
from cetra._experiments import ExperimentResult, Run, Score, aevaluate, evaluate
|
|
25
|
+
from cetra._llm import LlmSpan, llm_span
|
|
26
|
+
from cetra._prompts import Prompt, PromptNotAvailable, get_prompt
|
|
27
|
+
from cetra._runtime import flush, init, shutdown, span_processor, tracer_provider
|
|
28
|
+
from cetra._scores import score, uuid7
|
|
29
|
+
from cetra._spans import Span, current_span_id, current_trace_id, observe, span
|
|
30
|
+
from cetra._template import PromptCompileError
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"AddedQueueItems",
|
|
34
|
+
"AnnotationQueue",
|
|
35
|
+
"AnnotationQueueItem",
|
|
36
|
+
"ApiError",
|
|
37
|
+
"Client",
|
|
38
|
+
"ConfigError",
|
|
39
|
+
"Dataset",
|
|
40
|
+
"DatasetInfo",
|
|
41
|
+
"DatasetItem",
|
|
42
|
+
"ExperimentResult",
|
|
43
|
+
"LlmSpan",
|
|
44
|
+
"Prompt",
|
|
45
|
+
"PromptCompileError",
|
|
46
|
+
"PromptNotAvailable",
|
|
47
|
+
"QueueCounts",
|
|
48
|
+
"QueueItemStatus",
|
|
49
|
+
"QueueTarget",
|
|
50
|
+
"Run",
|
|
51
|
+
"Score",
|
|
52
|
+
"SkippedQueueItem",
|
|
53
|
+
"Span",
|
|
54
|
+
"__version__",
|
|
55
|
+
"aevaluate",
|
|
56
|
+
"context",
|
|
57
|
+
"current_span_id",
|
|
58
|
+
"current_trace_id",
|
|
59
|
+
"evaluate",
|
|
60
|
+
"flush",
|
|
61
|
+
"get_prompt",
|
|
62
|
+
"init",
|
|
63
|
+
"llm_span",
|
|
64
|
+
"observe",
|
|
65
|
+
"score",
|
|
66
|
+
"shutdown",
|
|
67
|
+
"span",
|
|
68
|
+
"span_processor",
|
|
69
|
+
"tracer_provider",
|
|
70
|
+
"uuid7",
|
|
71
|
+
]
|