unique_toolkit 0.7.37__tar.gz → 0.7.39__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.
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/CHANGELOG.md +7 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/PKG-INFO +8 -1
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/pyproject.toml +15 -1
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/sse_client.py +3 -3
- unique_toolkit-0.7.39/unique_toolkit/framework_utilities/langchain/client.py +45 -0
- unique_toolkit-0.7.39/unique_toolkit/framework_utilities/openai/client.py +45 -0
- unique_toolkit-0.7.39/unique_toolkit/framework_utilities/openai/message_builder.py +133 -0
- unique_toolkit-0.7.39/unique_toolkit/framework_utilities/utils.py +23 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/LICENSE +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/README.md +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/_common/_base_service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/_common/_time_utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/_common/exception.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/_common/validate_required_values.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/_common/validators.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/event_util.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/init_logging.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/init_sdk.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/performance/async_tasks.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/performance/async_wrapper.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/unique_settings.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/verification.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/functions.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/state.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/chat/utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/content/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/content/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/content/functions.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/content/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/content/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/content/utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/embedding/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/embedding/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/embedding/functions.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/embedding/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/embedding/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/embedding/utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/config.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/context_relevancy/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/context_relevancy/prompts.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/context_relevancy/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/context_relevancy/utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/exception.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/prompts.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/output_parser.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/framework_utilities/langchain/history.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/builder.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/functions.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/infos.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/prompt.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/reference.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/language_model/utils.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/protocols/support.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/constants.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/functions.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/schemas.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/service.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/smart_rules/__init__.py +0 -0
- {unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/smart_rules/compile.py +0 -0
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.39] - 2025-07-28
|
|
9
|
+
- Implement utitilites to work with openai client
|
|
10
|
+
- Implement utitilites to work with langchain llm
|
|
11
|
+
|
|
12
|
+
## [0.7.38] - 2025-07-25
|
|
13
|
+
- Fix issues with secret strings in settings
|
|
14
|
+
|
|
8
15
|
## [0.7.36] - 2025-07-25
|
|
9
16
|
- Fix issues with settings
|
|
10
17
|
- Add testing to unique settings
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_toolkit
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.39
|
|
4
4
|
Summary:
|
|
5
5
|
License: Proprietary
|
|
6
6
|
Author: Martin Fadler
|
|
@@ -113,6 +113,13 @@ All notable changes to this project will be documented in this file.
|
|
|
113
113
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
114
114
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
115
115
|
|
|
116
|
+
## [0.7.39] - 2025-07-28
|
|
117
|
+
- Implement utitilites to work with openai client
|
|
118
|
+
- Implement utitilites to work with langchain llm
|
|
119
|
+
|
|
120
|
+
## [0.7.38] - 2025-07-25
|
|
121
|
+
- Fix issues with secret strings in settings
|
|
122
|
+
|
|
116
123
|
## [0.7.36] - 2025-07-25
|
|
117
124
|
- Fix issues with settings
|
|
118
125
|
- Add testing to unique settings
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "unique_toolkit"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.39"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = [
|
|
6
6
|
"Martin Fadler <martin.fadler@unique.ch>",
|
|
@@ -24,6 +24,20 @@ unique-sdk = "^0.9.40"
|
|
|
24
24
|
pydantic-settings = "^2.10.1"
|
|
25
25
|
sseclient = "^0.0.27"
|
|
26
26
|
|
|
27
|
+
[tool.poetry.group.openai]
|
|
28
|
+
optional = true
|
|
29
|
+
|
|
30
|
+
[tool.poetry.group.openai.dependencies]
|
|
31
|
+
openai = "^1.97.0"
|
|
32
|
+
|
|
33
|
+
[tool.poetry.group.langchain]
|
|
34
|
+
optional = true
|
|
35
|
+
|
|
36
|
+
[tool.poetry.group.langchain.dependencies]
|
|
37
|
+
openai = "^1.97.0"
|
|
38
|
+
langchain = "^0.3.27"
|
|
39
|
+
langchain-openai = "^0.3.28"
|
|
40
|
+
|
|
27
41
|
[tool.poetry.group.dev.dependencies]
|
|
28
42
|
ruff = "0.11.7"
|
|
29
43
|
pytest = "^7.4.3"
|
|
@@ -13,8 +13,8 @@ def get_sse_client(
|
|
|
13
13
|
) -> SSEClient:
|
|
14
14
|
url = f"{unique_settings.app.base_url}/public/event-socket/events/stream?subscriptions={','.join(subscriptions)}"
|
|
15
15
|
headers = {
|
|
16
|
-
"Authorization": f"Bearer {unique_settings.app.key}",
|
|
17
|
-
"x-app-id": unique_settings.app.id,
|
|
18
|
-
"x-company-id": unique_settings.auth.company_id,
|
|
16
|
+
"Authorization": f"Bearer {unique_settings.app.key.get_secret_value()}",
|
|
17
|
+
"x-app-id": unique_settings.app.id.get_secret_value(),
|
|
18
|
+
"x-company-id": unique_settings.auth.company_id.get_secret_value(),
|
|
19
19
|
}
|
|
20
20
|
return SSEClient(url=url, headers=headers)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import logging
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from unique_toolkit.app.unique_settings import UniqueSettings
|
|
6
|
+
from unique_toolkit.framework_utilities.utils import get_default_headers
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger("toolkit.framework_utilities.langchain")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LangchainNotInstalledError(ImportError):
|
|
12
|
+
"""Raised when langchain-openai package is not installed but functionality requiring it is accessed."""
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
super().__init__(
|
|
16
|
+
"langchain-openai package is not installed. Install it with 'poetry install --with langchain'."
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if importlib.util.find_spec("langchain_openai") is not None:
|
|
21
|
+
from langchain_openai import ChatOpenAI
|
|
22
|
+
else:
|
|
23
|
+
raise LangchainNotInstalledError()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_client(env_file: Path | None = None) -> ChatOpenAI:
|
|
27
|
+
"""Get a Langchain ChatOpenAI client instance.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
env_file: Optional path to environment file
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
ChatOpenAI client instance
|
|
34
|
+
|
|
35
|
+
Raises:
|
|
36
|
+
LangchainNotInstalledError: If langchain-openai package is not installed
|
|
37
|
+
"""
|
|
38
|
+
settings = UniqueSettings.from_env(env_file=env_file)
|
|
39
|
+
|
|
40
|
+
return ChatOpenAI(
|
|
41
|
+
base_url=settings.app.base_url + "/openai-proxy/",
|
|
42
|
+
default_headers=get_default_headers(settings.app, settings.auth),
|
|
43
|
+
model="AZURE_GPT_4o_2024_0806",
|
|
44
|
+
api_key=settings.app.key,
|
|
45
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import logging
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from unique_toolkit.app.unique_settings import UniqueSettings
|
|
6
|
+
from unique_toolkit.framework_utilities.utils import get_default_headers
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger("toolkit.framework_utilities.openai")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OpenAINotInstalledError(ImportError):
|
|
12
|
+
"""Raised when OpenAI package is not installed but functionality requiring it is accessed."""
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
super().__init__(
|
|
16
|
+
"OpenAI package is not installed. Install it with 'poetry install --with openai'."
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if importlib.util.find_spec("openai") is not None:
|
|
21
|
+
from openai import OpenAI
|
|
22
|
+
else:
|
|
23
|
+
raise OpenAINotInstalledError()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_openai_client(env_file: Path | None = None) -> OpenAI:
|
|
27
|
+
"""Get an OpenAI client instance.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
env_file: Optional path to environment file
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
OpenAI client instance
|
|
34
|
+
|
|
35
|
+
Raises:
|
|
36
|
+
OpenAINotInstalledError: If OpenAI package is not installed
|
|
37
|
+
"""
|
|
38
|
+
settings = UniqueSettings.from_env(env_file=env_file)
|
|
39
|
+
default_headers = get_default_headers(settings.app, settings.auth)
|
|
40
|
+
|
|
41
|
+
return OpenAI(
|
|
42
|
+
api_key=settings.app.key.get_secret_value(),
|
|
43
|
+
base_url=settings.app.base_url + "/openai-proxy/",
|
|
44
|
+
default_headers=default_headers,
|
|
45
|
+
)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
from collections.abc import Iterable
|
|
2
|
+
from typing import Self
|
|
3
|
+
|
|
4
|
+
from openai.types.chat.chat_completion_assistant_message_param import (
|
|
5
|
+
ChatCompletionAssistantMessageParam,
|
|
6
|
+
ContentArrayOfContentPart,
|
|
7
|
+
)
|
|
8
|
+
from openai.types.chat.chat_completion_content_part_param import (
|
|
9
|
+
ChatCompletionContentPartParam,
|
|
10
|
+
)
|
|
11
|
+
from openai.types.chat.chat_completion_content_part_text_param import (
|
|
12
|
+
ChatCompletionContentPartTextParam,
|
|
13
|
+
)
|
|
14
|
+
from openai.types.chat.chat_completion_developer_message_param import (
|
|
15
|
+
ChatCompletionDeveloperMessageParam,
|
|
16
|
+
)
|
|
17
|
+
from openai.types.chat.chat_completion_function_message_param import (
|
|
18
|
+
ChatCompletionFunctionMessageParam,
|
|
19
|
+
)
|
|
20
|
+
from openai.types.chat.chat_completion_message_param import ChatCompletionMessageParam
|
|
21
|
+
from openai.types.chat.chat_completion_system_message_param import (
|
|
22
|
+
ChatCompletionSystemMessageParam,
|
|
23
|
+
)
|
|
24
|
+
from openai.types.chat.chat_completion_tool_message_param import (
|
|
25
|
+
ChatCompletionToolMessageParam,
|
|
26
|
+
)
|
|
27
|
+
from openai.types.chat.chat_completion_user_message_param import (
|
|
28
|
+
ChatCompletionUserMessageParam,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class OpenAIMessageBuilder:
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
messages: list[ChatCompletionMessageParam] | None = None,
|
|
36
|
+
) -> None:
|
|
37
|
+
self._messages: list[ChatCompletionMessageParam] = []
|
|
38
|
+
if messages:
|
|
39
|
+
self._messages = messages
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def from_messages(cls, messages: list[ChatCompletionMessageParam]) -> Self:
|
|
43
|
+
builder = cls()
|
|
44
|
+
builder._messages = messages.copy()
|
|
45
|
+
return builder
|
|
46
|
+
|
|
47
|
+
def append_system_message(
|
|
48
|
+
self,
|
|
49
|
+
content: str | Iterable[ChatCompletionContentPartTextParam],
|
|
50
|
+
name: str = "user",
|
|
51
|
+
) -> Self:
|
|
52
|
+
self._messages.append(
|
|
53
|
+
ChatCompletionSystemMessageParam(
|
|
54
|
+
content=content,
|
|
55
|
+
role="system",
|
|
56
|
+
name=name,
|
|
57
|
+
),
|
|
58
|
+
)
|
|
59
|
+
return self
|
|
60
|
+
|
|
61
|
+
def append_user_message(
|
|
62
|
+
self,
|
|
63
|
+
content: str | Iterable[ChatCompletionContentPartParam],
|
|
64
|
+
name: str = "user",
|
|
65
|
+
) -> Self:
|
|
66
|
+
self._messages.append(
|
|
67
|
+
ChatCompletionUserMessageParam(
|
|
68
|
+
content=content,
|
|
69
|
+
role="user",
|
|
70
|
+
name=name,
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
return self
|
|
74
|
+
|
|
75
|
+
def append_assistant_message(
|
|
76
|
+
self,
|
|
77
|
+
content: str | Iterable[ContentArrayOfContentPart],
|
|
78
|
+
name: str = "assistant",
|
|
79
|
+
) -> Self:
|
|
80
|
+
self._messages.append(
|
|
81
|
+
ChatCompletionAssistantMessageParam(
|
|
82
|
+
content=content,
|
|
83
|
+
role="assistant",
|
|
84
|
+
name=name,
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
return self
|
|
88
|
+
|
|
89
|
+
def append_developper_message(
|
|
90
|
+
self,
|
|
91
|
+
content: str | Iterable[ChatCompletionContentPartTextParam],
|
|
92
|
+
name: str = "developer",
|
|
93
|
+
) -> Self:
|
|
94
|
+
self._messages.append(
|
|
95
|
+
ChatCompletionDeveloperMessageParam(
|
|
96
|
+
content=content,
|
|
97
|
+
role="developer",
|
|
98
|
+
name=name,
|
|
99
|
+
),
|
|
100
|
+
)
|
|
101
|
+
return self
|
|
102
|
+
|
|
103
|
+
def append_function_message(
|
|
104
|
+
self,
|
|
105
|
+
content: str | None,
|
|
106
|
+
name: str = "function",
|
|
107
|
+
) -> Self:
|
|
108
|
+
self._messages.append(
|
|
109
|
+
ChatCompletionFunctionMessageParam(
|
|
110
|
+
content=content,
|
|
111
|
+
role="function",
|
|
112
|
+
name=name,
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
return self
|
|
116
|
+
|
|
117
|
+
def append_tool_message(
|
|
118
|
+
self,
|
|
119
|
+
content: str | Iterable[ChatCompletionContentPartTextParam],
|
|
120
|
+
tool_call_id: str,
|
|
121
|
+
) -> Self:
|
|
122
|
+
self._messages.append(
|
|
123
|
+
ChatCompletionToolMessageParam(
|
|
124
|
+
content=content,
|
|
125
|
+
role="tool",
|
|
126
|
+
tool_call_id=tool_call_id,
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
return self
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def messages(self) -> list[ChatCompletionMessageParam]:
|
|
133
|
+
return self._messages
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from unique_toolkit.app.unique_settings import UniqueApp, UniqueAuth
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def auth_headers(auth_settings: UniqueAuth) -> dict[str, str]:
|
|
5
|
+
return {
|
|
6
|
+
"x-user-id": auth_settings.user_id.get_secret_value(),
|
|
7
|
+
"x-company-id": auth_settings.company_id.get_secret_value(),
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def app_headers(app_settings: UniqueApp) -> dict[str, str]:
|
|
12
|
+
return {
|
|
13
|
+
"x-app-id": app_settings.id.get_secret_value(),
|
|
14
|
+
"Authorization": f"Bearer {app_settings.key.get_secret_value()}",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_default_headers(app_settings: UniqueApp, auth_settings: UniqueAuth):
|
|
19
|
+
default_headers = {}
|
|
20
|
+
default_headers.update(app_headers(app_settings))
|
|
21
|
+
default_headers.update(auth_headers(auth_settings))
|
|
22
|
+
default_headers["x-api-version"] = "2023-12-06"
|
|
23
|
+
return default_headers
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/_common/validate_required_values.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/performance/async_tasks.py
RENAMED
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/app/performance/async_wrapper.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/context_relevancy/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/constants.py
RENAMED
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/prompts.py
RENAMED
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/service.py
RENAMED
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/evaluators/hallucination/utils.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
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/__init__.py
RENAMED
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/constants.py
RENAMED
|
File without changes
|
{unique_toolkit-0.7.37 → unique_toolkit-0.7.39}/unique_toolkit/short_term_memory/functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|