srai-chat
A chat library frontend for srai services.
installation
pip install srai-chat
environment
requires the following environment variables set \
"TELEGRAM_ROOT_ID": ""
"TELEGRAM_TOKEN": ""
"OPENAI_API_KEY": ""
"MONGODB_CONNECTION_STRING": "
"MONGODB_DATABASE_NAME": ""
usage example
import os
from srai_chat.skill.mode_chat_gpt import ModeChatGpt
from srai_chat.skill.skill_image_tag import SkillImageTag
from srai_chat.skill.skill_mode_tools import SkillModeTools
def initialize_default() -> "ContextManager":
context = ContextManager()
ContextManager._instance = context
telegram_token = os.environ["TELEGRAM_TOKEN"]
telegram_root_id = int(os.environ["TELEGRAM_ROOT_ID"])
openai_api_key = os.environ["OPENAI_API_KEY"]
connection_string = os.environ["MONGODB_CONNECTION_STRING"]
database_name = os.environ["MONGODB_DATABASE_NAME"]
from srai_chat.service.service_chat_telegram import ServiceChatTelegram
from srai_chat.service.service_openai_chat_gpt import ServiceOpenaiChatGpt
from srai_chat.service.service_persistency_mongo import ServicePersistencyMongo
from srai_chat.service.service_sceduling import ServiceSceduling
context.service_chat = ServiceChatTelegram(context, telegram_token, telegram_root_id)
context.service_persistency = ServicePersistencyMongo(context, connection_string, database_name)
context.service_openai_chat_gpt = ServiceOpenaiChatGpt(context, openai_api_key)
context.service_sceduling = ServiceSceduling(context)
return context
if __name__ == "__main__":
from srai_chat.service.context_manager import ContextManager
context_manager = initialize_default()
# initialize services
# ServiceSceduling.initialize(bot)
context_manager.initialize()
context_manager.service_chat.register_skill(SkillImageTag())
context_manager.service_chat.register_skill(SkillModeTools())
context_manager.service_chat.register_mode(ModeChatGpt())
context_manager.service_chat.mode_default = context_manager.service_chat.dict_mode["ModeChatGpt"]
# start services
context_manager.start()
Metadata
Release files for srai-chat 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| srai-chat-0.1.5.tar.gz | 12.5 kB | Without provenance | Details for srai-chat-0.1.5.tar.gz |
Release files / srai-chat-0.1.5.tar.gz
| Download URL | srai-chat-0.1.5.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e838b2ea7f6ce3aead983c59de99c088cb47898e95747faee6a6265e6bbb347
|
|
BLAKE2b-256 checksum How to use checksums |
8a798eaab85c1db5dce6b994ea57a166cec220f4c411e3808320f2383f0775fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Security for srai-chat 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.