aidial-sdk 0.46.0.dev8__tar.gz → 0.47.0.dev2__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.
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/PKG-INFO +10 -11
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/request.py +1 -3
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/response.py +1 -3
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/telemetry/init.py +19 -9
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/streaming.py +1 -2
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/pyproject.toml +13 -13
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/LICENSE +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/README.md +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/_errors.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/_pydantic/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/_pydantic/_compat.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/_pydantic/_model_config.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/application.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/_cache.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/_types.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/base.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/choice.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/choice_base.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/chunks.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/enums.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/form.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/function_call.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/function_tool_call.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/stage.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/_headers.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/configuration.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/from_request_mixin.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/rate.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/tokenize.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/truncate_prompt.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/embeddings/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/embeddings/base.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/embeddings/request.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/embeddings/response.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/exceptions.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/header_propagator.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/py.typed +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/pydantic/v2.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/pydantic_v1/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/response_headers.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/telemetry/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/telemetry/_context.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/telemetry/types.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/__init__.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_attachment.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_cancel_scope.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_content_stream.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_disconnect_middleware.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_indexed_list.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_json_log_formatter.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_logging.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_reflection.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/env.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/errors.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/json.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/log_config.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/logging.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/merge_chunks.py +0 -0
- {aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/pydantic.py +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aidial-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.47.0.dev2
|
|
4
4
|
Summary: Framework to create applications and model adapters for AI DIAL
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Author: EPAM RAIL
|
|
8
8
|
Author-email: SpecialEPM-DIALDevTeam@epam.com
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.11,<4.0
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -19,14 +18,14 @@ Requires-Dist: fastapi (>=0.51,<1.0)
|
|
|
19
18
|
Requires-Dist: httpx (>=0.25.0,<1.0) ; extra == "httpx"
|
|
20
19
|
Requires-Dist: opentelemetry-api (>=1.22.0,<2.0) ; extra == "telemetry"
|
|
21
20
|
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (>=1.22.0,<2.0) ; extra == "telemetry"
|
|
22
|
-
Requires-Dist: opentelemetry-exporter-prometheus (>=0.
|
|
23
|
-
Requires-Dist: opentelemetry-instrumentation-aiohttp-client (>=0.
|
|
24
|
-
Requires-Dist: opentelemetry-instrumentation-fastapi (>=0.
|
|
25
|
-
Requires-Dist: opentelemetry-instrumentation-httpx (>=0.
|
|
26
|
-
Requires-Dist: opentelemetry-instrumentation-logging (>=0.
|
|
27
|
-
Requires-Dist: opentelemetry-instrumentation-requests (>=0.
|
|
28
|
-
Requires-Dist: opentelemetry-instrumentation-system-metrics (>=0.
|
|
29
|
-
Requires-Dist: opentelemetry-instrumentation-urllib (>=0.
|
|
21
|
+
Requires-Dist: opentelemetry-exporter-prometheus (>=0.64b0) ; extra == "telemetry"
|
|
22
|
+
Requires-Dist: opentelemetry-instrumentation-aiohttp-client (>=0.64b0) ; extra == "telemetry"
|
|
23
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi (>=0.64b0) ; extra == "telemetry"
|
|
24
|
+
Requires-Dist: opentelemetry-instrumentation-httpx (>=0.64b0) ; extra == "telemetry"
|
|
25
|
+
Requires-Dist: opentelemetry-instrumentation-logging (>=0.64b0) ; extra == "telemetry"
|
|
26
|
+
Requires-Dist: opentelemetry-instrumentation-requests (>=0.64b0) ; extra == "telemetry"
|
|
27
|
+
Requires-Dist: opentelemetry-instrumentation-system-metrics (>=0.64b0) ; extra == "telemetry"
|
|
28
|
+
Requires-Dist: opentelemetry-instrumentation-urllib (>=0.64b0) ; extra == "telemetry"
|
|
30
29
|
Requires-Dist: opentelemetry-sdk (>=1.22.0,<2.0) ; extra == "telemetry"
|
|
31
30
|
Requires-Dist: prometheus-client (>=0.17.1,<1.0) ; extra == "telemetry"
|
|
32
31
|
Requires-Dist: pydantic (>=1.10.17,<3)
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
from collections.abc import Mapping
|
|
2
2
|
from enum import Enum
|
|
3
|
-
from typing import Annotated, Any, Literal
|
|
4
|
-
|
|
5
|
-
from typing_extensions import assert_never
|
|
3
|
+
from typing import Annotated, Any, Literal, assert_never
|
|
6
4
|
|
|
7
5
|
from aidial_sdk._pydantic import (
|
|
8
6
|
PYDANTIC_V2,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from collections.abc import Callable, Coroutine
|
|
3
3
|
from time import time
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any, assert_never
|
|
5
5
|
from uuid import uuid4
|
|
6
6
|
|
|
7
|
-
from typing_extensions import assert_never
|
|
8
|
-
|
|
9
7
|
from aidial_sdk.chat_completion._cache import CacheBreakpointPath
|
|
10
8
|
from aidial_sdk.chat_completion._types import ChunkQueue
|
|
11
9
|
from aidial_sdk.chat_completion.choice import Choice
|
|
@@ -18,7 +18,7 @@ from opentelemetry.instrumentation.system_metrics import (
|
|
|
18
18
|
)
|
|
19
19
|
from opentelemetry.instrumentation.urllib import URLLibInstrumentor
|
|
20
20
|
from opentelemetry.metrics import set_meter_provider
|
|
21
|
-
from opentelemetry.sdk._logs import LoggerProvider
|
|
21
|
+
from opentelemetry.sdk._logs import LoggerProvider
|
|
22
22
|
from opentelemetry.sdk._logs.export import (
|
|
23
23
|
BatchLogRecordProcessor,
|
|
24
24
|
ConsoleLogRecordExporter,
|
|
@@ -86,13 +86,6 @@ def init_telemetry(app: FastAPI | None, config: TelemetryConfig):
|
|
|
86
86
|
except ImportError:
|
|
87
87
|
pass
|
|
88
88
|
|
|
89
|
-
set_logging_format = config.tracing.logging
|
|
90
|
-
if set_logging_format:
|
|
91
|
-
# Remove any competing handlers to avoid duplicate logging
|
|
92
|
-
remove_stream_handlers(logging.getLogger(), sys.stderr)
|
|
93
|
-
|
|
94
|
-
LoggingInstrumentor().instrument(set_logging_format=set_logging_format)
|
|
95
|
-
|
|
96
89
|
if config.logs is not None:
|
|
97
90
|
# Adding a handler to the root logger which exports the logs to OTLP or to the console as JSON.
|
|
98
91
|
provider = LoggerProvider(resource=resource)
|
|
@@ -120,7 +113,24 @@ def init_telemetry(app: FastAPI | None, config: TelemetryConfig):
|
|
|
120
113
|
)
|
|
121
114
|
|
|
122
115
|
set_logger_provider(provider)
|
|
123
|
-
|
|
116
|
+
|
|
117
|
+
if config.tracing is not None or config.logs is not None:
|
|
118
|
+
# OTel's text format writes to stderr, which `console_export` takes over.
|
|
119
|
+
set_logging_format = (
|
|
120
|
+
config.tracing is not None
|
|
121
|
+
and config.tracing.logging
|
|
122
|
+
and not (config.logs is not None and config.logs.console_export)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
if set_logging_format:
|
|
126
|
+
# Remove any competing handlers to avoid duplicate logging
|
|
127
|
+
remove_stream_handlers(logging.getLogger(), sys.stderr)
|
|
128
|
+
|
|
129
|
+
LoggingInstrumentor().instrument(
|
|
130
|
+
set_logging_format=set_logging_format,
|
|
131
|
+
inject_trace_context=config.tracing is not None,
|
|
132
|
+
enable_log_auto_instrumentation=config.logs is not None,
|
|
133
|
+
)
|
|
124
134
|
|
|
125
135
|
if config.metrics is not None:
|
|
126
136
|
metric_readers = []
|
|
@@ -4,11 +4,10 @@ from collections.abc import AsyncIterator, Awaitable, Callable
|
|
|
4
4
|
from typing import (
|
|
5
5
|
Any,
|
|
6
6
|
TypeVar,
|
|
7
|
+
assert_never,
|
|
7
8
|
cast,
|
|
8
9
|
)
|
|
9
10
|
|
|
10
|
-
from typing_extensions import assert_never
|
|
11
|
-
|
|
12
11
|
from aidial_sdk.chat_completion.chunks import BaseChunkWithDefaults
|
|
13
12
|
from aidial_sdk.exceptions import HTTPException as DIALException
|
|
14
13
|
from aidial_sdk.utils._cancel_scope import CancelScope
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "aidial-sdk"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.47.0.dev2"
|
|
4
4
|
description = "Framework to create applications and model adapters for AI DIAL"
|
|
5
5
|
authors = [{ name = "EPAM RAIL", email = "SpecialEPM-DIALDevTeam@epam.com" }]
|
|
6
6
|
license = "Apache-2.0"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
requires-python = ">=3.
|
|
8
|
+
requires-python = ">=3.11,<4.0"
|
|
9
9
|
dependencies = [
|
|
10
10
|
"fastapi (>=0.51,<1.0)",
|
|
11
11
|
"uvicorn (>=0.19,<1.0)",
|
|
@@ -23,14 +23,14 @@ telemetry = [
|
|
|
23
23
|
"opentelemetry-sdk (>=1.22.0,<2.0)",
|
|
24
24
|
"opentelemetry-api (>=1.22.0,<2.0)",
|
|
25
25
|
"opentelemetry-exporter-otlp-proto-grpc (>=1.22.0,<2.0)",
|
|
26
|
-
"opentelemetry-instrumentation-aiohttp-client (>=0.
|
|
27
|
-
"opentelemetry-instrumentation-fastapi (>=0.
|
|
28
|
-
"opentelemetry-instrumentation-httpx (>=0.
|
|
29
|
-
"opentelemetry-instrumentation-logging (>=0.
|
|
30
|
-
"opentelemetry-instrumentation-requests (>=0.
|
|
31
|
-
"opentelemetry-instrumentation-system-metrics (>=0.
|
|
32
|
-
"opentelemetry-instrumentation-urllib (>=0.
|
|
33
|
-
"opentelemetry-exporter-prometheus (>=0.
|
|
26
|
+
"opentelemetry-instrumentation-aiohttp-client (>=0.64b0)",
|
|
27
|
+
"opentelemetry-instrumentation-fastapi (>=0.64b0)",
|
|
28
|
+
"opentelemetry-instrumentation-httpx (>=0.64b0)",
|
|
29
|
+
"opentelemetry-instrumentation-logging (>=0.64b0)",
|
|
30
|
+
"opentelemetry-instrumentation-requests (>=0.64b0)",
|
|
31
|
+
"opentelemetry-instrumentation-system-metrics (>=0.64b0)",
|
|
32
|
+
"opentelemetry-instrumentation-urllib (>=0.64b0)",
|
|
33
|
+
"opentelemetry-exporter-prometheus (>=0.64b0)",
|
|
34
34
|
"prometheus-client (>=0.17.1,<1.0)",
|
|
35
35
|
]
|
|
36
36
|
httpx = ["httpx (>=0.25.0,<1.0)"]
|
|
@@ -39,14 +39,14 @@ httpx = ["httpx (>=0.25.0,<1.0)"]
|
|
|
39
39
|
pytest = "^9.0.3"
|
|
40
40
|
pytest-asyncio = "^1.3.0"
|
|
41
41
|
nox = "^2023.4.22"
|
|
42
|
-
pillow = "^
|
|
42
|
+
pillow = "^13.0.0"
|
|
43
43
|
httpx = "^0.25.0"
|
|
44
44
|
respx = "^0.21.1"
|
|
45
45
|
aiohttp = "^3.14.4"
|
|
46
46
|
aiointercept = "^0.1.7"
|
|
47
47
|
requests = "^2.33"
|
|
48
48
|
responses = "^0.25.3"
|
|
49
|
-
httpx2 = "^2.12.0"
|
|
49
|
+
httpx2 = "^2.12.0" # required for Starlette.TestClient
|
|
50
50
|
openai = "^2.46.0" # third-party logger for log-takeover tests
|
|
51
51
|
|
|
52
52
|
[tool.poetry.group.lint.dependencies]
|
|
@@ -86,7 +86,7 @@ exclude = [
|
|
|
86
86
|
|
|
87
87
|
[tool.ruff]
|
|
88
88
|
line-length = 80
|
|
89
|
-
target-version = "
|
|
89
|
+
target-version = "py311"
|
|
90
90
|
|
|
91
91
|
[tool.ruff.lint]
|
|
92
92
|
select = [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/function_call.py
RENAMED
|
File without changes
|
{aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/chat_completion/function_tool_call.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/deployment/from_request_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidial_sdk-0.46.0.dev8 → aidial_sdk-0.47.0.dev2}/aidial_sdk/utils/_disconnect_middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|