Skip to main content

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.

from aicosmos_client.client import AICosmosClient 

# login
client = AICosmosClient(
    base_url="https://aicosmos.ai/api",
    username="xxx",
    password="xxx",
    auto_trust=True,
)

# 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)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aicosmos_client-0.0.6.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aicosmos_client-0.0.6-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file aicosmos_client-0.0.6.tar.gz.

File metadata

  • Download URL: aicosmos_client-0.0.6.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for aicosmos_client-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c0c0e1fe584eaa1a8ba17a90f36ca5e7cc8e49563cdfe541507db9a4076bbc7a
MD5 515c72f0fd1e8e562ce6b07799035800
BLAKE2b-256 3c3558c6298d9c2093a1478a69e45e3639a74c3e0ab62c90ed71f793b447d72e

See more details on using hashes here.

File details

Details for the file aicosmos_client-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for aicosmos_client-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7bbbd86a6dd526f3ab0f733b23519298f8a25ae05e856280f7f00d41b5d13a28
MD5 a9ec56a2df6d53ea06ca3f897abf4c30
BLAKE2b-256 b96b0dcbcdb02889d2d22fbbc633aafe00a0efaa481d4c861b692ee7433b2e25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page