overmind 0.1.19__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 (36) hide show
  1. overmind-0.1.19/LICENSE +21 -0
  2. overmind-0.1.19/PKG-INFO +149 -0
  3. overmind-0.1.19/README.md +109 -0
  4. overmind-0.1.19/overmind/__init__.py +23 -0
  5. overmind-0.1.19/overmind/_vendor/__init__.py +1 -0
  6. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/__init__.py +54 -0
  7. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/__init__.py +399 -0
  8. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/chat_wrappers.py +1192 -0
  9. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/completion_wrappers.py +292 -0
  10. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/config.py +15 -0
  11. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/embeddings_wrappers.py +311 -0
  12. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/event_emitter.py +108 -0
  13. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/event_models.py +41 -0
  14. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/image_gen_wrappers.py +68 -0
  15. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/shared/span_utils.py +0 -0
  16. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/utils.py +190 -0
  17. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/v0/__init__.py +176 -0
  18. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/v1/__init__.py +386 -0
  19. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/v1/assistant_wrappers.py +329 -0
  20. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/v1/event_handler_wrapper.py +134 -0
  21. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/v1/realtime_wrappers.py +730 -0
  22. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/v1/responses_wrappers.py +1113 -0
  23. overmind-0.1.19/overmind/_vendor/opentelemetry_instrumentation_openai/version.py +1 -0
  24. overmind-0.1.19/overmind/client.py +270 -0
  25. overmind-0.1.19/overmind/exceptions.py +32 -0
  26. overmind-0.1.19/overmind/langchain/__init__.py +0 -0
  27. overmind-0.1.19/overmind/langchain/callbacks.py +133 -0
  28. overmind-0.1.19/overmind/layers.py +105 -0
  29. overmind-0.1.19/overmind/models.py +160 -0
  30. overmind-0.1.19/overmind/overmind_sdk.py +247 -0
  31. overmind-0.1.19/overmind/policies.py +143 -0
  32. overmind-0.1.19/overmind/utils/__init__.py +0 -0
  33. overmind-0.1.19/overmind/utils/api_settings.py +31 -0
  34. overmind-0.1.19/overmind/utils/formatters.py +116 -0
  35. overmind-0.1.19/overmind/utils/serializers.py +5 -0
  36. overmind-0.1.19/pyproject.toml +60 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Overmind Python Client
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,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: overmind
3
+ Version: 0.1.19
4
+ Summary: Python client for Overmind API
5
+ License-File: LICENSE
6
+ Keywords: overmind,ai,api,client,policy,enforcement
7
+ Author: Overmind Ltd
8
+ Requires-Python: >=3.10,<4
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Provides-Extra: full
20
+ Requires-Dist: langgraph (>=1.0.7)
21
+ Requires-Dist: opentelemetry-api (>=1.35.0,<2.0.0)
22
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.35.0,<2.0.0)
23
+ Requires-Dist: opentelemetry-instrumentation (>=0.60b1)
24
+ Requires-Dist: opentelemetry-instrumentation-fastapi (>=0.60b1,<0.61)
25
+ Requires-Dist: opentelemetry-instrumentation-httpx (>=0.60b1,<0.61) ; extra == "full"
26
+ Requires-Dist: opentelemetry-instrumentation-logging (>=0.60b1,<0.61) ; extra == "full"
27
+ Requires-Dist: opentelemetry-instrumentation-requests (>=0.60b1,<0.61) ; extra == "full"
28
+ Requires-Dist: opentelemetry-sdk (>=1.35.0,<2.0.0)
29
+ Requires-Dist: opentelemetry-semantic-conventions (>=0.60b1)
30
+ Requires-Dist: opentelemetry-semantic-conventions-ai (>=0.4.13,<0.5.0)
31
+ Requires-Dist: packaging (>=23.0,<24.0)
32
+ Requires-Dist: pydantic (>=2.0.0,<3.0.0)
33
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
34
+ Requires-Dist: rich (>=14.0.0,<15.0.0)
35
+ Requires-Dist: typing-extensions (>=4.0.0,<5.0.0)
36
+ Requires-Dist: wrapt (>=1.14.0,<2.0.0)
37
+ Project-URL: Homepage, https://github.com/overmind-core/overmind-python
38
+ Project-URL: Repository, https://github.com/overmind-core/overmind-python
39
+ Description-Content-Type: text/markdown
40
+
41
+ # Overmind Client
42
+
43
+ [![CI Checks](https://github.com/overmind-core/overmind-python/actions/workflows/publish.yml/badge.svg)](https://github.com/overmind-core/overmind-python/actions/workflows/publish.yml)
44
+ [![PyPI version](https://img.shields.io/pypi/v/overmind.svg)](https://pypi.org/project/overmind/)
45
+
46
+ A client for the Overmind API that provides easy access to AI provider endpoints with policy enforcement.
47
+
48
+ ## Features
49
+
50
+ - **Easy Integration**: Use major providers like OpenAI with the same call signatures
51
+ - **Policy Enforcement**: Apply customizable policies to your LLM inputs and outputs
52
+ - **Observability**: Log and explore all LLM calls and policy results
53
+
54
+ ## Installation
55
+
56
+
57
+
58
+ ```bash
59
+ pip install overmind
60
+ ```
61
+
62
+
63
+ ## Quick Start
64
+
65
+ ### Use Overmind Proxy
66
+
67
+ Get your free Overmind API key at [console.overmindlab.ai](https://console.overmindlab.ai)
68
+
69
+ Below we initialise the Overmind client and call GPT-5-mini with `anonymize_pii` and `reject_irrelevant_answer` policies. This will prevent PII data leakage and ensure only relevant answers are produced.
70
+ ```python
71
+ import os
72
+ from overmind.client import OvermindClient
73
+
74
+ # Set env variables (or pass directly to the client)
75
+ # Get your free overmind API key at console.overmindlab.ai
76
+ os.environ["OVERMIND_API_KEY"] = "your_overmind_api_key"
77
+ os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
78
+
79
+ overmind = OvermindClient()
80
+
81
+
82
+ # Use existing OpenAI client methods
83
+ response = overmind.openai.responses.create(
84
+ model='gpt-5-mini',
85
+ input="Should I switch my mortgage now or wait for a year to have a lower interest rate?",
86
+ # Overmind built-in policies
87
+ input_policies=['anonymize_pii'],
88
+ output_policies=['reject_irrelevant_answer'],
89
+ )
90
+
91
+ response.summary()
92
+ ```
93
+
94
+
95
+
96
+ ### Define your own policies
97
+ There are different policy templates that can be set up at invocation time.
98
+ ```python
99
+
100
+ # Define input policy to filter out PII
101
+ input_pii_policy = {
102
+ 'policy_template': 'anonymize_pii',
103
+ 'parameters': {
104
+ 'pii_types': ['DEMOGRAPHIC_DATA', 'FINANCIAL_ID']
105
+ }
106
+ }
107
+
108
+ # Define output policy to check response against criteria
109
+ output_llm_judge_criteria = {
110
+ 'policy_template': 'reject_llm_judge_with_criteria',
111
+ 'parameters': {
112
+ 'criteria': [
113
+ "Must not be a financial advice",
114
+ "Must answer the question fully",
115
+ ]
116
+ }
117
+ }
118
+
119
+ input_messages = [
120
+ {
121
+ "role": "user",
122
+ "content": "Hi my name is Jon, account number 20194812. Should I switch my mortgage now or wait for a year to have a lower interest rate?"
123
+ }
124
+ ]
125
+
126
+ result = overmind.openai.responses.create(
127
+ model='gpt-5-mini',
128
+ input=input_messages,
129
+ input_policies=[input_pii_policy],
130
+ output_policies=[output_llm_judge_criteria]
131
+ )
132
+
133
+ result.summary()
134
+ ```
135
+ ### Use Overmind Layers
136
+
137
+ For more complex use cases you can choose Overmind Layers - an API to call standalone policies without relying on us to call LLMs.
138
+
139
+ This use case is best demonstrated in our [LangGraph integration tutorial](https://github.com/overmind-core/overmind-python/blob/main/docs/Overmind%20Layers%20%26%20LangGraph%20tutorial.ipynb), although the Layers can be used with any framework.
140
+
141
+ ## Further usage
142
+
143
+ There are a more detailed tutorials available for [Overmind Proxy](https://github.com/overmind-core/overmind-python/blob/main/docs/Overmind%20Proxy%20tutorial.ipynb) and [Overmind Layers & LangGraph integration](https://github.com/overmind-core/overmind-python/blob/main/docs/Overmind%20Layers%20%26%20LangGraph%20tutorial.ipynb).
144
+
145
+ We are not storing your API keys and you are solely responsible for managing them and the associated costs.
146
+
147
+ On our side we run policy executions for free as this is an alpha stage product. We may impose usage limits and scale our services up and down from time to time.
148
+
149
+ We appreciate any feedback, collaboration or other suggestions. You can reach out at [support@evallab.dev](mailto:support@evallab.dev)
@@ -0,0 +1,109 @@
1
+ # Overmind Client
2
+
3
+ [![CI Checks](https://github.com/overmind-core/overmind-python/actions/workflows/publish.yml/badge.svg)](https://github.com/overmind-core/overmind-python/actions/workflows/publish.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/overmind.svg)](https://pypi.org/project/overmind/)
5
+
6
+ A client for the Overmind API that provides easy access to AI provider endpoints with policy enforcement.
7
+
8
+ ## Features
9
+
10
+ - **Easy Integration**: Use major providers like OpenAI with the same call signatures
11
+ - **Policy Enforcement**: Apply customizable policies to your LLM inputs and outputs
12
+ - **Observability**: Log and explore all LLM calls and policy results
13
+
14
+ ## Installation
15
+
16
+
17
+
18
+ ```bash
19
+ pip install overmind
20
+ ```
21
+
22
+
23
+ ## Quick Start
24
+
25
+ ### Use Overmind Proxy
26
+
27
+ Get your free Overmind API key at [console.overmindlab.ai](https://console.overmindlab.ai)
28
+
29
+ Below we initialise the Overmind client and call GPT-5-mini with `anonymize_pii` and `reject_irrelevant_answer` policies. This will prevent PII data leakage and ensure only relevant answers are produced.
30
+ ```python
31
+ import os
32
+ from overmind.client import OvermindClient
33
+
34
+ # Set env variables (or pass directly to the client)
35
+ # Get your free overmind API key at console.overmindlab.ai
36
+ os.environ["OVERMIND_API_KEY"] = "your_overmind_api_key"
37
+ os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
38
+
39
+ overmind = OvermindClient()
40
+
41
+
42
+ # Use existing OpenAI client methods
43
+ response = overmind.openai.responses.create(
44
+ model='gpt-5-mini',
45
+ input="Should I switch my mortgage now or wait for a year to have a lower interest rate?",
46
+ # Overmind built-in policies
47
+ input_policies=['anonymize_pii'],
48
+ output_policies=['reject_irrelevant_answer'],
49
+ )
50
+
51
+ response.summary()
52
+ ```
53
+
54
+
55
+
56
+ ### Define your own policies
57
+ There are different policy templates that can be set up at invocation time.
58
+ ```python
59
+
60
+ # Define input policy to filter out PII
61
+ input_pii_policy = {
62
+ 'policy_template': 'anonymize_pii',
63
+ 'parameters': {
64
+ 'pii_types': ['DEMOGRAPHIC_DATA', 'FINANCIAL_ID']
65
+ }
66
+ }
67
+
68
+ # Define output policy to check response against criteria
69
+ output_llm_judge_criteria = {
70
+ 'policy_template': 'reject_llm_judge_with_criteria',
71
+ 'parameters': {
72
+ 'criteria': [
73
+ "Must not be a financial advice",
74
+ "Must answer the question fully",
75
+ ]
76
+ }
77
+ }
78
+
79
+ input_messages = [
80
+ {
81
+ "role": "user",
82
+ "content": "Hi my name is Jon, account number 20194812. Should I switch my mortgage now or wait for a year to have a lower interest rate?"
83
+ }
84
+ ]
85
+
86
+ result = overmind.openai.responses.create(
87
+ model='gpt-5-mini',
88
+ input=input_messages,
89
+ input_policies=[input_pii_policy],
90
+ output_policies=[output_llm_judge_criteria]
91
+ )
92
+
93
+ result.summary()
94
+ ```
95
+ ### Use Overmind Layers
96
+
97
+ For more complex use cases you can choose Overmind Layers - an API to call standalone policies without relying on us to call LLMs.
98
+
99
+ This use case is best demonstrated in our [LangGraph integration tutorial](https://github.com/overmind-core/overmind-python/blob/main/docs/Overmind%20Layers%20%26%20LangGraph%20tutorial.ipynb), although the Layers can be used with any framework.
100
+
101
+ ## Further usage
102
+
103
+ There are a more detailed tutorials available for [Overmind Proxy](https://github.com/overmind-core/overmind-python/blob/main/docs/Overmind%20Proxy%20tutorial.ipynb) and [Overmind Layers & LangGraph integration](https://github.com/overmind-core/overmind-python/blob/main/docs/Overmind%20Layers%20%26%20LangGraph%20tutorial.ipynb).
104
+
105
+ We are not storing your API keys and you are solely responsible for managing them and the associated costs.
106
+
107
+ On our side we run policy executions for free as this is an alpha stage product. We may impose usage limits and scale our services up and down from time to time.
108
+
109
+ We appreciate any feedback, collaboration or other suggestions. You can reach out at [support@evallab.dev](mailto:support@evallab.dev)
@@ -0,0 +1,23 @@
1
+ """
2
+ Overmind Python Client
3
+
4
+ A Python client for the Overmind API that provides easy access to AI provider endpoints
5
+ with policy enforcement and automatic observability.
6
+ """
7
+
8
+ from .client import OvermindClient
9
+ from .exceptions import OvermindAPIError, OvermindAuthenticationError, OvermindError
10
+ from .overmind_sdk import init, get_tracer, set_user, set_tag, capture_exception
11
+
12
+ __version__ = "0.1.0"
13
+ __all__ = [
14
+ "OvermindClient",
15
+ "OvermindError",
16
+ "OvermindAPIError",
17
+ "OvermindAuthenticationError",
18
+ "init",
19
+ "get_tracer",
20
+ "set_user",
21
+ "set_tag",
22
+ "capture_exception",
23
+ ]
@@ -0,0 +1 @@
1
+ # Vendored packages for overmind
@@ -0,0 +1,54 @@
1
+ from typing import Callable, Collection, Optional
2
+
3
+ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
4
+ from .shared.config import Config
5
+ from .utils import is_openai_v1
6
+ from typing_extensions import Coroutine
7
+
8
+ _instruments = ("openai >= 0.27.0",)
9
+
10
+
11
+ class OpenAIInstrumentor(BaseInstrumentor):
12
+ """An instrumentor for OpenAI's client library."""
13
+
14
+ def __init__(
15
+ self,
16
+ enrich_assistant: bool = False,
17
+ exception_logger=None,
18
+ get_common_metrics_attributes: Callable[[], dict] = lambda: {},
19
+ upload_base64_image: Optional[
20
+ Callable[[str, str, str, str], Coroutine[None, None, str]]
21
+ ] = lambda *args: "",
22
+ enable_trace_context_propagation: bool = True,
23
+ use_legacy_attributes: bool = True,
24
+ ):
25
+ super().__init__()
26
+ Config.enrich_assistant = enrich_assistant
27
+ Config.exception_logger = exception_logger
28
+ Config.get_common_metrics_attributes = get_common_metrics_attributes
29
+ Config.upload_base64_image = upload_base64_image
30
+ Config.enable_trace_context_propagation = enable_trace_context_propagation
31
+ Config.use_legacy_attributes = use_legacy_attributes
32
+
33
+ def instrumentation_dependencies(self) -> Collection[str]:
34
+ return _instruments
35
+
36
+ def _instrument(self, **kwargs):
37
+ if is_openai_v1():
38
+ from .v1 import OpenAIV1Instrumentor
39
+
40
+ OpenAIV1Instrumentor().instrument(**kwargs)
41
+ else:
42
+ from .v0 import OpenAIV0Instrumentor
43
+
44
+ OpenAIV0Instrumentor().instrument(**kwargs)
45
+
46
+ def _uninstrument(self, **kwargs):
47
+ if is_openai_v1():
48
+ from .v1 import OpenAIV1Instrumentor
49
+
50
+ OpenAIV1Instrumentor().uninstrument(**kwargs)
51
+ else:
52
+ from .v0 import OpenAIV0Instrumentor
53
+
54
+ OpenAIV0Instrumentor().uninstrument(**kwargs)