unique_toolkit 0.5.20__tar.gz → 0.5.21__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.5.20 → unique_toolkit-0.5.21}/CHANGELOG.md +3 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/PKG-INFO +4 -1
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/pyproject.toml +1 -1
- unique_toolkit-0.5.21/unique_toolkit/chat/schemas.py +62 -0
- unique_toolkit-0.5.20/unique_toolkit/chat/schemas.py +0 -30
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/LICENSE +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/README.md +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/__init__.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/_common/_base_service.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/_common/_time_utils.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/__init__.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/init_logging.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/init_sdk.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/performance/async_tasks.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/performance/async_wrapper.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/schemas.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/verification.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/chat/__init__.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/chat/service.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/chat/state.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/chat/utils.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/content/__init__.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/content/schemas.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/content/service.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/content/utils.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/embedding/__init__.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/embedding/schemas.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/embedding/service.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/embedding/utils.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/language_model/__init__.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/language_model/infos.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/language_model/schemas.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/language_model/service.py +0 -0
- {unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/unique_toolkit/language_model/utils.py +0 -0
@@ -5,6 +5,9 @@ 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.5.21] - 2024-09-16
|
9
|
+
- Add `tool` as new role `ChatMessage`, as well as `tool_calls` and `tool_call_id` as additional parameters
|
10
|
+
|
8
11
|
## [0.5.20] - 2024-09-16
|
9
12
|
- `LanguageModelService` now supports complete_util_async that can be called without instantiating the class, currently being used in the Hallucination service and evaluation API
|
10
13
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.21
|
4
4
|
Summary:
|
5
5
|
License: MIT
|
6
6
|
Author: Martin Fadler
|
@@ -100,6 +100,9 @@ All notable changes to this project will be documented in this file.
|
|
100
100
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
101
101
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
102
102
|
|
103
|
+
## [0.5.21] - 2024-09-16
|
104
|
+
- Add `tool` as new role `ChatMessage`, as well as `tool_calls` and `tool_call_id` as additional parameters
|
105
|
+
|
103
106
|
## [0.5.20] - 2024-09-16
|
104
107
|
- `LanguageModelService` now supports complete_util_async that can be called without instantiating the class, currently being used in the Hallucination service and evaluation API
|
105
108
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
from enum import StrEnum
|
2
|
+
from typing import Optional
|
3
|
+
|
4
|
+
from humps import camelize
|
5
|
+
from pydantic import (
|
6
|
+
BaseModel,
|
7
|
+
ConfigDict,
|
8
|
+
Field,
|
9
|
+
field_validator,
|
10
|
+
model_validator,
|
11
|
+
)
|
12
|
+
|
13
|
+
# set config to convert camelCase to snake_case
|
14
|
+
model_config = ConfigDict(
|
15
|
+
alias_generator=camelize, populate_by_name=True, arbitrary_types_allowed=True
|
16
|
+
)
|
17
|
+
|
18
|
+
|
19
|
+
class ChatMessageRole(StrEnum):
|
20
|
+
USER = "user"
|
21
|
+
ASSISTANT = "assistant"
|
22
|
+
TOOL = "tool"
|
23
|
+
|
24
|
+
|
25
|
+
class Function(BaseModel):
|
26
|
+
model_config = model_config
|
27
|
+
|
28
|
+
name: str
|
29
|
+
arguments: str
|
30
|
+
|
31
|
+
|
32
|
+
class ToolCall(BaseModel):
|
33
|
+
model_config = model_config
|
34
|
+
|
35
|
+
id: str
|
36
|
+
type: str
|
37
|
+
function: Function
|
38
|
+
|
39
|
+
|
40
|
+
class ChatMessage(BaseModel):
|
41
|
+
model_config = model_config
|
42
|
+
|
43
|
+
id: str | None = None
|
44
|
+
object: str | None = None
|
45
|
+
content: str = Field(alias="text")
|
46
|
+
role: ChatMessageRole
|
47
|
+
tool_calls: Optional[list[ToolCall]] = None
|
48
|
+
tool_call_id: Optional[str] = None
|
49
|
+
debug_info: dict | None = {}
|
50
|
+
|
51
|
+
# TODO make sdk return role consistently in lowercase
|
52
|
+
# Currently needed as sdk returns role in uppercase
|
53
|
+
@field_validator("role", mode="before")
|
54
|
+
def set_role(cls, value: str):
|
55
|
+
return value.lower()
|
56
|
+
|
57
|
+
# Ensure tool_call_ids is required if role is 'tool'
|
58
|
+
@model_validator(mode="after")
|
59
|
+
def check_tool_call_ids_for_tool_role(self):
|
60
|
+
if self.role == ChatMessageRole.TOOL and not self.tool_call_id:
|
61
|
+
raise ValueError("tool_call_ids is required when role is 'tool'")
|
62
|
+
return self
|
@@ -1,30 +0,0 @@
|
|
1
|
-
from enum import StrEnum
|
2
|
-
|
3
|
-
from humps import camelize
|
4
|
-
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
5
|
-
|
6
|
-
# set config to convert camelCase to snake_case
|
7
|
-
model_config = ConfigDict(
|
8
|
-
alias_generator=camelize, populate_by_name=True, arbitrary_types_allowed=True
|
9
|
-
)
|
10
|
-
|
11
|
-
|
12
|
-
class ChatMessageRole(StrEnum):
|
13
|
-
USER = "user"
|
14
|
-
ASSISTANT = "assistant"
|
15
|
-
|
16
|
-
|
17
|
-
class ChatMessage(BaseModel):
|
18
|
-
model_config = model_config
|
19
|
-
|
20
|
-
id: str | None = None
|
21
|
-
object: str | None = None
|
22
|
-
content: str = Field(alias="text")
|
23
|
-
role: ChatMessageRole
|
24
|
-
debug_info: dict | None = {}
|
25
|
-
|
26
|
-
# TODO make sdk return role consistently in lowercase
|
27
|
-
# Currently needed as sdk returns role in uppercase
|
28
|
-
@field_validator("role", mode="before")
|
29
|
-
def set_role(cls, value: str):
|
30
|
-
return value.lower()
|
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.5.20 → unique_toolkit-0.5.21}/unique_toolkit/app/performance/async_tasks.py
RENAMED
File without changes
|
{unique_toolkit-0.5.20 → unique_toolkit-0.5.21}/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
|