client for AICosmos platform
Project description
Client for AICosmos
This package implements the client for AICosmos. Before using this package, please make sure that you have a valid account for AICosmos.
AICosmosClient
By using this client, you can chat with our backend in "base" mode. To login, you will need the server's address, your username and your password. You can either start a new session, or use an existing one.
Our framework is a little bit different from "chat completions", where you give an llm the conversation history. Instead, your conversation history, along with other tool execution results, are stored in our database. This gives your a clean and simple interface to use, without worrying about constructing complicated contexts. The following code signs in to your account, and starts a new conversation in "base" mode.
from aicosmos_client.client import AICosmosClient
# login
client = AICosmosClient(
base_url="https://aicosmos.ai/api", username="xxx", password="xxx"
)
# create a new session
try:
new_session_id = client.create_session()
except Exception as e:
print(f"Error creating new session: {e}")
exit(0)
# lookup all the sessions
try:
my_sessions = client.get_my_sessions()
except Exception as e:
print(f"Error getting my sessions: {e}")
exit(0)
# [{"session_id", "title"}, ...]
print(my_sessions)
# enjoy the conversation
try:
conversation_history = client.chat(new_session_id, "Hello")
except Exception as e:
print(f"Error chatting: {e}")
exit(0)
print(conversation_history)
Apart from "base" mode, we also support "code" mode and "lean" mode. In these modes, we provide you with a code editor, which you can open and interact with your web browser.
# enjoy the conversation
try:
conversation_history = client.chat(
new_session_id, "De Morgan's law. Start now.", mode="lean"
)
except Exception as e:
print(f"Error chatting: {e}")
exit(0)
print(conversation_history)
# open this link with your web browser (e.g. Edge, Chrome)
url = client.get_browser_url(new_session_id)
print(url)
AICosmosCLI
To show that the client is enough to build an application, we offer you an command-line interface!
from aicosmos_client.cli import AICosmosCLI
# url: https://aicosmos.ai/api
AICosmosCLI().run()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aicosmos_client-0.0.12.tar.gz.
File metadata
- Download URL: aicosmos_client-0.0.12.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31d7313b80a3f0ac11203073c3d6ffa88fad344890d137fe6bf3007fd8a39f7d
|
|
| MD5 |
72dc6be191fad95bceead771ce99e7e9
|
|
| BLAKE2b-256 |
b32e171e834e2a967c71d94e409c90e385cee512bcdf92f588bbd44a8f66dd98
|
File details
Details for the file aicosmos_client-0.0.12-py3-none-any.whl.
File metadata
- Download URL: aicosmos_client-0.0.12-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
962530a50197944c797b4e94039abc56f9a509b73c4e2f4c85d56da126f9aa3f
|
|
| MD5 |
10d6d7e2f20192281cb5efcdcea90de9
|
|
| BLAKE2b-256 |
90448c2ee2d6bd3e95eb30d63e609ff64292ba7a14841c520b8ca9c166c42a61
|