docent 0.1.66__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.
Files changed (88) hide show
  1. docent-0.1.66/.gitignore +210 -0
  2. docent-0.1.66/LICENSE.md +13 -0
  3. docent-0.1.66/PKG-INFO +37 -0
  4. docent-0.1.66/README.md +21 -0
  5. docent-0.1.66/docent/__init__.py +22 -0
  6. docent-0.1.66/docent/_llm_util/__init__.py +0 -0
  7. docent-0.1.66/docent/_llm_util/data_models/__init__.py +0 -0
  8. docent-0.1.66/docent/_llm_util/data_models/exceptions.py +95 -0
  9. docent-0.1.66/docent/_llm_util/data_models/llm_output.py +328 -0
  10. docent-0.1.66/docent/_llm_util/llm_svc.py +421 -0
  11. docent-0.1.66/docent/_llm_util/model_registry.py +206 -0
  12. docent-0.1.66/docent/_llm_util/providers/__init__.py +0 -0
  13. docent-0.1.66/docent/_llm_util/providers/anthropic.py +602 -0
  14. docent-0.1.66/docent/_llm_util/providers/common.py +70 -0
  15. docent-0.1.66/docent/_llm_util/providers/google.py +589 -0
  16. docent-0.1.66/docent/_llm_util/providers/openai.py +831 -0
  17. docent-0.1.66/docent/_llm_util/providers/openrouter.py +162 -0
  18. docent-0.1.66/docent/_llm_util/providers/preference_types.py +268 -0
  19. docent-0.1.66/docent/_llm_util/providers/provider_registry.py +172 -0
  20. docent-0.1.66/docent/_log_util/__init__.py +3 -0
  21. docent-0.1.66/docent/_log_util/logger.py +143 -0
  22. docent-0.1.66/docent/data_models/__init__.py +16 -0
  23. docent-0.1.66/docent/data_models/_tiktoken_util.py +91 -0
  24. docent-0.1.66/docent/data_models/agent_run.py +615 -0
  25. docent-0.1.66/docent/data_models/chat/__init__.py +39 -0
  26. docent-0.1.66/docent/data_models/chat/content.py +62 -0
  27. docent-0.1.66/docent/data_models/chat/message.py +193 -0
  28. docent-0.1.66/docent/data_models/chat/response_format.py +48 -0
  29. docent-0.1.66/docent/data_models/chat/tool.py +109 -0
  30. docent-0.1.66/docent/data_models/citation.py +256 -0
  31. docent-0.1.66/docent/data_models/context_config.py +88 -0
  32. docent-0.1.66/docent/data_models/feedback.py +539 -0
  33. docent-0.1.66/docent/data_models/formatted_objects.py +84 -0
  34. docent-0.1.66/docent/data_models/judge.py +17 -0
  35. docent-0.1.66/docent/data_models/metadata_util.py +188 -0
  36. docent-0.1.66/docent/data_models/reading.py +595 -0
  37. docent-0.1.66/docent/data_models/regex.py +56 -0
  38. docent-0.1.66/docent/data_models/report.py +16 -0
  39. docent-0.1.66/docent/data_models/transcript.py +429 -0
  40. docent-0.1.66/docent/data_models/util.py +170 -0
  41. docent-0.1.66/docent/judges/__init__.py +27 -0
  42. docent-0.1.66/docent/judges/analysis.py +77 -0
  43. docent-0.1.66/docent/judges/impl.py +717 -0
  44. docent-0.1.66/docent/judges/runner.py +136 -0
  45. docent-0.1.66/docent/judges/stats.py +205 -0
  46. docent-0.1.66/docent/judges/types.py +400 -0
  47. docent-0.1.66/docent/judges/util/forgiving_json.py +108 -0
  48. docent-0.1.66/docent/judges/util/meta_schema.json +119 -0
  49. docent-0.1.66/docent/judges/util/meta_schema.py +37 -0
  50. docent-0.1.66/docent/judges/util/parse_output.py +55 -0
  51. docent-0.1.66/docent/judges/util/template_formatter.py +167 -0
  52. docent-0.1.66/docent/judges/util/voting.py +351 -0
  53. docent-0.1.66/docent/loaders/load_inspect.py +215 -0
  54. docent-0.1.66/docent/mcp/__init__.py +9 -0
  55. docent-0.1.66/docent/mcp/__main__.py +10 -0
  56. docent-0.1.66/docent/mcp/server.py +558 -0
  57. docent-0.1.66/docent/py.typed +0 -0
  58. docent-0.1.66/docent/samples/__init__.py +3 -0
  59. docent-0.1.66/docent/samples/load.py +9 -0
  60. docent-0.1.66/docent/samples/log.eval +0 -0
  61. docent-0.1.66/docent/samples/tb_airline.json +1 -0
  62. docent-0.1.66/docent/sdk/__init__.py +16 -0
  63. docent-0.1.66/docent/sdk/_agent_runs.py +217 -0
  64. docent-0.1.66/docent/sdk/_base.py +346 -0
  65. docent-0.1.66/docent/sdk/_client_util.py +210 -0
  66. docent-0.1.66/docent/sdk/_collections.py +426 -0
  67. docent-0.1.66/docent/sdk/_dql.py +315 -0
  68. docent-0.1.66/docent/sdk/_feedback.py +190 -0
  69. docent-0.1.66/docent/sdk/_labels.py +225 -0
  70. docent-0.1.66/docent/sdk/_readings.py +1693 -0
  71. docent-0.1.66/docent/sdk/_reports.py +281 -0
  72. docent-0.1.66/docent/sdk/_results.py +311 -0
  73. docent-0.1.66/docent/sdk/_rubrics.py +320 -0
  74. docent-0.1.66/docent/sdk/_sharing.py +229 -0
  75. docent-0.1.66/docent/sdk/agent_run_writer.py +322 -0
  76. docent-0.1.66/docent/sdk/client.py +47 -0
  77. docent-0.1.66/docent/sdk/integrations/__init__.py +27 -0
  78. docent-0.1.66/docent/sdk/integrations/harbor.py +893 -0
  79. docent-0.1.66/docent/sdk/integrations/inspect.py +150 -0
  80. docent-0.1.66/docent/sdk/integrations/nemogym.py +611 -0
  81. docent-0.1.66/docent/sdk/integrations/util.py +84 -0
  82. docent-0.1.66/docent/sdk/llm_context.py +1170 -0
  83. docent-0.1.66/docent/sdk/llm_request.py +47 -0
  84. docent-0.1.66/docent/sdk/reading.py +327 -0
  85. docent-0.1.66/docent/sdk/util.py +16 -0
  86. docent-0.1.66/docent/trace.py +2809 -0
  87. docent-0.1.66/pyproject.toml +62 -0
  88. docent-0.1.66/uv.lock +3276 -0
@@ -0,0 +1,210 @@
1
+ **/*_gitignore.*
2
+ **/*_gitignore/
3
+ *.db
4
+ .stignore
5
+ *syncthing*
6
+ .DS_Store
7
+ # *.sql (neil: disabled for ursid)
8
+ *.gz
9
+ *.tgz
10
+
11
+ *.tfstate
12
+ *.tfstate.backup
13
+ */.terraform/
14
+ */*.terraform.*
15
+
16
+ .idea/
17
+
18
+ # Byte-compiled / optimized / DLL files
19
+ __pycache__/
20
+ *.py[cod]
21
+ *$py.class
22
+
23
+ # C extensions
24
+ *.so
25
+
26
+ # Distribution / packaging
27
+ .Python
28
+ build/
29
+ develop-eggs/
30
+ dist/
31
+ downloads/
32
+ eggs/
33
+ .eggs/
34
+ parts/
35
+ sdist/
36
+ var/
37
+ wheels/
38
+ share/python-wheels/
39
+ *.egg-info/
40
+ .installed.cfg
41
+ *.egg
42
+ MANIFEST
43
+
44
+ # PyInstaller
45
+ # Usually these files are written by a python script from a template
46
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
47
+ *.manifest
48
+ *.spec
49
+
50
+ # Installer logs
51
+ pip-log.txt
52
+ pip-delete-this-directory.txt
53
+
54
+ # Unit test / coverage reports
55
+ htmlcov/
56
+ .tox/
57
+ .nox/
58
+ .coverage
59
+ .coverage.*
60
+ .cache
61
+ nosetests.xml
62
+ coverage.xml
63
+ *.cover
64
+ *.py,cover
65
+ .hypothesis/
66
+ .pytest_cache/
67
+ cover/
68
+
69
+ # Translations
70
+ *.mo
71
+ *.pot
72
+
73
+ # Django stuff:
74
+ *.log
75
+ local_settings.py
76
+ db.sqlite3
77
+ db.sqlite3-journal
78
+
79
+ # Flask stuff:
80
+ instance/
81
+ .webassets-cache
82
+
83
+ # Scrapy stuff:
84
+ .scrapy
85
+
86
+ # Sphinx documentation
87
+ docs/_build/
88
+
89
+ # PyBuilder
90
+ .pybuilder/
91
+ target/
92
+
93
+ # Jupyter Notebook
94
+ .ipynb_checkpoints
95
+
96
+ # IPython
97
+ profile_default/
98
+ ipython_config.py
99
+
100
+ # pyenv
101
+ # For a library or package, you might want to ignore these files since the code is
102
+ # intended to run in multiple environments; otherwise, check them in:
103
+ .python-version
104
+
105
+ # pipenv
106
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
107
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
108
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
109
+ # install all needed dependencies.
110
+ #Pipfile.lock
111
+
112
+ # poetry
113
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
114
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
115
+ # commonly ignored for libraries.
116
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
117
+ #poetry.lock
118
+
119
+ # pdm
120
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
121
+ #pdm.lock
122
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
123
+ # in version control.
124
+ # https://pdm.fming.dev/#use-with-ide
125
+ .pdm.toml
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .env.*
140
+ !.env.template
141
+ .venv
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Docent
149
+ docent.env*
150
+ docent_analyses/
151
+
152
+ # Spyder project settings
153
+ .spyderproject
154
+ .spyproject
155
+
156
+ # Rope project settings
157
+ .ropeproject
158
+
159
+ # mkdocs documentation
160
+ /site
161
+
162
+ # mypy
163
+ .mypy_cache/
164
+ .dmypy.json
165
+ dmypy.json
166
+
167
+ # Pyre type checker
168
+ .pyre/
169
+
170
+ # pytype static type analyzer
171
+ .pytype/
172
+
173
+ # Cython debug symbols
174
+ cython_debug/
175
+
176
+ # PyCharm
177
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
178
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
179
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
180
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
181
+ #.idea/
182
+
183
+ # wandb
184
+ **/wandb/
185
+
186
+ # Marimo notebook outputs
187
+ **/__marimo__/
188
+
189
+ # yarn
190
+ **/.yarn/
191
+ **/.pnp.*
192
+
193
+ # data
194
+ *.npy
195
+ *.csv
196
+ *.pkl
197
+
198
+ # personal
199
+ inspect_evals
200
+
201
+ *.swp
202
+
203
+ # test data cache
204
+ data/cache
205
+
206
+ # dont commit package lock, force use of bun lock
207
+ package-lock.json
208
+
209
+ # Claude Code worktrees
210
+ .claude/worktrees/
@@ -0,0 +1,13 @@
1
+ Copyright 2025 Clarity AI Research Inc., dba Transluce
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
docent-0.1.66/PKG-INFO ADDED
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: docent
3
+ Version: 0.1.66
4
+ Summary: Docent SDK
5
+ Project-URL: Homepage, https://github.com/TransluceAI/docent
6
+ Project-URL: Issues, https://github.com/TransluceAI/docent/issues
7
+ Project-URL: Docs, https://transluce.mintlify.app
8
+ Author-email: Transluce <info@transluce.org>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE.md
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: anthropic>=0.47.0
13
+ Requires-Dist: backoff>=2.2.1
14
+ Requires-Dist: google-genai>=1.16.1
15
+ Requires-Dist: httpx>=0.27.0
16
+ Requires-Dist: inspect-ai>=0.3.132
17
+ Requires-Dist: jsonschema>=4.24.0
18
+ Requires-Dist: mcp>=1.0.0
19
+ Requires-Dist: openai>=1.68.0
20
+ Requires-Dist: opentelemetry-api>=1.34.1
21
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.34.1
22
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.34.1
23
+ Requires-Dist: opentelemetry-instrumentation-anthropic>=0.40.14
24
+ Requires-Dist: opentelemetry-instrumentation-bedrock>=0.40.14
25
+ Requires-Dist: opentelemetry-instrumentation-google-generativeai>=0.40.14
26
+ Requires-Dist: opentelemetry-instrumentation-langchain>=0.40.14
27
+ Requires-Dist: opentelemetry-instrumentation-openai>=0.40.14
28
+ Requires-Dist: opentelemetry-instrumentation-threading>=0.55b1
29
+ Requires-Dist: opentelemetry-sdk>=1.34.1
30
+ Requires-Dist: orjson>=3.11.6
31
+ Requires-Dist: pandas>=2.3.3
32
+ Requires-Dist: pydantic>=2.11.7
33
+ Requires-Dist: pyjwt>=2.12.0
34
+ Requires-Dist: python-dotenv>=1.0.0
35
+ Requires-Dist: pyyaml>=6.0.2
36
+ Requires-Dist: tiktoken>=0.7.0
37
+ Requires-Dist: tqdm>=4.67.1
@@ -0,0 +1,21 @@
1
+ !!! note
2
+ Docent remains in alpha. The API is subject to change.
3
+
4
+ # Docent Python SDK
5
+
6
+ The official Python SDK for [Docent](https://github.com/TransluceAI/docent) - a platform for analyzing and visualizing AI agent execution traces.
7
+
8
+ ## Overview
9
+
10
+ Docent helps you understand AI agent behavior by providing tools to collect, analyze, and visualize agent execution data. This SDK allows you to programmatically interact with the Docent platform to:
11
+
12
+ - Create and manage collections of agent runs
13
+ - Upload agent execution traces and transcripts
14
+ - Define custom dimensions and filters
15
+ - Perform searches and analyses on agent behavior
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install docent-python
21
+ ```
@@ -0,0 +1,22 @@
1
+ __all__ = [
2
+ "Docent",
3
+ "init",
4
+ "load_config_file",
5
+ "AgentRunRef",
6
+ "TranscriptRef",
7
+ "TranscriptSliceRef",
8
+ "ReadingResultRef",
9
+ "ResultRef",
10
+ "Prompt",
11
+ ]
12
+
13
+ from docent.sdk.agent_run_writer import init
14
+ from docent.sdk.client import Docent, load_config_file
15
+ from docent.sdk.llm_context import (
16
+ AgentRunRef,
17
+ Prompt,
18
+ ReadingResultRef,
19
+ ResultRef,
20
+ TranscriptRef,
21
+ TranscriptSliceRef,
22
+ )
File without changes
File without changes
@@ -0,0 +1,95 @@
1
+ from typing import Any
2
+
3
+
4
+ class LLMException(Exception):
5
+ error_type_id = "other"
6
+ user_message = "The model failed to respond. Please try again later."
7
+
8
+ def serialize(self) -> dict[str, Any]:
9
+ data: dict[str, Any] = {
10
+ "type": self.__class__.__name__,
11
+ "user_message": getattr(self, "user_message", None),
12
+ "error_type_id": getattr(self, "error_type_id", None),
13
+ }
14
+ if failed_output := getattr(self, "failed_output", None):
15
+ data["failed_output"] = str(failed_output)
16
+ return data
17
+
18
+ @classmethod
19
+ def serialize_llm_errors(cls, errors: list["LLMException"]) -> list[dict[str, Any]]:
20
+ return [error.serialize() for error in errors]
21
+
22
+
23
+ class CompletionTooLongException(LLMException):
24
+ error_type_id = "completion_too_long"
25
+ user_message = (
26
+ "The model stopped because the completion hit max_new_tokens. "
27
+ "Increase max_new_tokens and try again."
28
+ )
29
+
30
+
31
+ class RateLimitException(LLMException):
32
+ error_type_id = "rate_limit"
33
+ user_message = "Rate limited by the model provider. Please wait and try again."
34
+
35
+
36
+ class ContextWindowException(LLMException):
37
+ error_type_id = "context_window"
38
+ user_message = "Context window exceeded."
39
+
40
+
41
+ class InvalidPromptException(LLMException):
42
+ error_type_id = "invalid_prompt"
43
+ user_message = "The model provider rejected this prompt for safety reasons."
44
+
45
+
46
+ class NoResponseException(LLMException):
47
+ error_type_id = "no_response"
48
+ user_message = "The model returned an empty response. Please try again later."
49
+
50
+
51
+ class DocentUsageLimitException(LLMException):
52
+ error_type_id = "docent_usage_limit"
53
+ user_message = (
54
+ "Free weekly usage limit reached. Add your own API key in settings or "
55
+ "email docent@transluce.org to inquire about custom usage limits."
56
+ )
57
+
58
+
59
+ class ProviderAuthenticationException(LLMException):
60
+ error_type_id = "provider_authentication"
61
+
62
+ def __init__(self, message: str = ""):
63
+ super().__init__(message)
64
+ self.user_message = (
65
+ "The model provider API key could not be authenticated. "
66
+ "If you added your own key, update it in Settings > Model providers."
67
+ )
68
+
69
+
70
+ class ValidationFailedException(LLMException):
71
+ error_type_id = "validation_failed"
72
+ user_message = "The model returned invalid output that failed validation."
73
+
74
+ def __init__(self, message: str = "", failed_output: str | None = None):
75
+ super().__init__(message)
76
+ self.failed_output = failed_output
77
+
78
+
79
+ class TimeoutException(LLMException):
80
+ error_type_id = "timeout"
81
+ user_message = "The request timed out. The model took too long to respond."
82
+
83
+
84
+ LLM_ERROR_TYPES: list[type[LLMException]] = [
85
+ LLMException,
86
+ CompletionTooLongException,
87
+ RateLimitException,
88
+ ContextWindowException,
89
+ InvalidPromptException,
90
+ NoResponseException,
91
+ DocentUsageLimitException,
92
+ ProviderAuthenticationException,
93
+ ValidationFailedException,
94
+ TimeoutException,
95
+ ]