No project description provided
Project description
Unique Toolkit
This package provides highlevel abstractions and methods on top of unique_sdk
to ease application development for the Unique Platform.
The Toolkit is structured along the following domains:
unique_toolkit.chat
unique_toolkit.content
unique_toolkit.embedding
unique_toolkit.language_model
Each domain comprises a service class (in service.py
) which encapsulates the basic functionalities to interact with the domain entities, the schemas
(in schemas.py
) used in the service and required for interacting with the service functions, utility functions (in utils.py
) which give additional
functionality to interact with the domain entities (all domains except embedding) and other domain specific functionalities which are explained in the respective domain documentation.
In addition, the unique_toolkit.app
module provides functions to initialize apps that interact with the Unique platform. It also includes some utility functions to run async tasks in parallel (async webserver and app implementation required).
Changelog
See the CHANGELOG.md file for details on changes and version history.
Domains
App
The unique_toolkit.app
module encompasses functions for initializing and securing apps that will interact with the Unique platform.
init_logging.py
can be used to initalize the logger either with unique dictConfig or an any other dictConfig.init_sdk.py
can be used to initialize the sdk using the correct env variables and retrieving the endpoint secret.schemas.py
contains the Event schema which can be used to parse and validate the unique.chat.external-module.chosen event.verification.py
can be used to verify the endpoint secret and construct the event.
Chat
The unique_toolkit.chat
module encompasses all chat related functionality.
state.py
comprises the ChatState which is used to store the current state of the chat interaction and the user information.service.py
comprises the ChatService and provides an interface to manage and load the chat history and interact with the chat ui, e.g., creating a new assistant message.schemas.py
comprises all relevant schemas, e.g., ChatMessage, used in the ChatService.utils.py
comprises utility functions to use and convert ChatMessage objects in assistants, e.g., convert_chat_history_to_injectable_string converts the chat history to a string that can be injected into a prompt.
Content
The unique_toolkit.content
module encompasses all content related functionality. Content can be any type of textual data that is stored in the Knowledgebase on the Unique platform. During the ingestion of the content, the content is parsed, split in chunks, indexed, and stored in the database.
service.py
comprises the ContentService and provides an interface to interact with the content, e.g., search content, search content chunks, upload and download content.schemas.py
comprises all relevant schemas, e.g., Content and ContentChunk, used in the ContentService.utils.py
comprise utility functions to manipulate Content and ContentChunk objects, e.g., sort_content_chunks and merge_content_chunks.
Embedding
The unique_toolkit.embedding
module encompasses all embedding related functionality. Embeddings are used to represent textual data in a high-dimensional space. The embeddings can be used to calculate the similarity between two texts, for instance.
service.py
encompasses the EmbeddingService and provides an interface to interact with the embeddings, e.g., embed text and calculate the similarity between two texts.schemas.py
comprises all relevant schemas, e.g., Embeddings, used in the EmbeddingService.
Language Model
The unique_toolkit.language_model
module encompasses all language model related functionality and information on the different language models deployed through the
Unique platform.
infos.py
comprises the information on all language models deployed through the Unique platform. We recommend to use the LanguageModel class, initialized with the LanguageModelName, e.g., LanguageModel(LanguageModelName.AZURE_GPT_35_TURBO_16K) to get the information on the specific language model like the name, version, token limits or retirement date.service.py
comprises the LanguageModelService and provides an interface to interact with the language models, e.g., complete or stream_complete.schemas.py
comprises all relevant schemas, e.g., LanguageModelResponse, used in the LanguageModelService.utils.py
comprises utility functions to parse the output of the language model, e.g., convert_string_to_json finds and parses the last json object in a string.
Development instructions
-
Install poetry on your system (through
brew
orpipx
). -
Install
pyenv
and install python 3.11.pyenv
is recommended as otherwise poetry uses the python version used to install itself and not the user preferred python version. -
If you then run
python --version
in your terminal, you should be able to see python version as specified in.python-version
. -
Then finally run
poetry install
to install the package and all dependencies.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.5.1] - 2024-07-23
- correct documentation
[0.5.0] - 2024-07-23
Added
-
Added
unique_toolkit.app
module with the following components:init_logging.py
for initializing the logger.init_sdk.py
for initializing the SDK with environment variables.schemas.py
containing the Event schema.verification.py
for verifying the endpoint secret and constructing the event.
-
Added
unique_toolkit.chat
module with the following components:state.py
containing theChatState
class.service.py
containing theChatService
class for managing chat interactions.schemas.py
containing relevant schemas such asChatMessage
.utils.py
with utility functions for chat interactions.
-
Added
unique_toolkit.content
module with the following components:service.py
containing theContentService
class for interacting with content.schemas.py
containing relevant schemas such asContent
andContentChunk
.utils.py
with utility functions for manipulating content objects.
-
Added
unique_toolkit.embedding
module with the following components:service.py
containing theEmbeddingService
class for working with embeddings.schemas.py
containing relevant schemas such asEmbeddings
.
-
Added
unique_toolkit.language_model
module with the following components:infos.py
containing information on language models deployed on the Unique platform.service.py
containing theLanguageModelService
class for interacting with language models.schemas.py
containing relevant schemas such asLanguageModelResponse
.utils.py
with utility functions for parsing language model output.
[0.0.2] - 2024-07-10
- Initial release of
unique_toolkit
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file unique_toolkit-0.5.1.tar.gz
.
File metadata
- Download URL: unique_toolkit-0.5.1.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1024-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea56c5b49a332ecefe14e1c09a3fb286c69c2b1b5b0469c99748d80d7435defd |
|
MD5 | 6cc4e0e52ee8293810212e8f70063ff7 |
|
BLAKE2b-256 | b7ae19d090a5739f81ffcdb5e7b2fcfaaf0d902b42f93acd9b5da1ed73bec1e5 |
File details
Details for the file unique_toolkit-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: unique_toolkit-0.5.1-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1024-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c0553f0c0c06bea8fbae0603b3886fb3d3d2b3a68236ee294f29124b28d6032 |
|
MD5 | 991ab2870354e42c16ead048e1393d4d |
|
BLAKE2b-256 | cbaa1b5e605cb4ff8f63b14deb191e3ca06c04f800903bc725828596ac4957ed |