Skip to main content

A Python client for Metis to streamline API interactions, enabling easy management and customization of AI-driven chatbots and image models.

Project description

Metis Python Client

This Python client is designed to provide developers with a seamless integration into the Metisai api platform, enabling the efficient management and customization of generative AI-driven chatbots and image generation models.

Features

  • API Integration: Easy access to Metis's API endpoints for model selection, configuration, and management.
  • Model Customization: Tools to customize and fine-tune large language models (LLMs) for text and image generation according to specific requirements.
  • Monitoring: Capabilities to monitor the performance and quality of AI models, ensuring optimal functionality.
  • Simplified Deployment: Streamlined processes for transitioning from model development to production.

Installation

To install the Metis Python Client, run the following command:

pip install metisai

Usage

Session

Here’s a quick example of how to use the client to interact with Metis:

import metisai

# Initialize the client
metisbot = metisai.MetisBot(api_key=METIS_API_KEY, bot_id=METIS_BOT_ID)

# Initialize a session
session = metisbot.create_session()
message = metisbot.send_message(session, "Suggest me a list of 5 gifts for a 30 years boy who is tech-fan.")
print(message.content)
message2 = metisbot.send_message(session, "What if he is a book lover?")
print(message2.content)

# Delete a session
metisbot.delete_session(session)

Async

Here’s an example of async operation (this is not asyncio):

import metisai

# Initialize the client
metisbot = metisai.MetisBot(api_key=METIS_API_KEY, bot_id=METIS_BOT_ID)

prompt = "Suggest me a list of 5 gifts for a 30 years boy who is tech-fan."
session = metisbot.create_session()
task = metisbot.send_message_async(session, prompt)

while True:
    task_result = metisbot.retrieve_async_task(session, task)
    if task_result.status == "FINISHED":
        break
    time.sleep(1)
print(task_result.message.content)
print()
metisbot.delete_session(session)

Stream

Here’s an example of stream usage:

import metisai

# Initialize the client
metisbot = metisai.MetisBot(api_key=METIS_API_KEY, bot_id=METIS_BOT_ID)

prompt = "Suggest me a list of 5 gifts for a 30 years boy who is tech-fan."
stream = metisbot.stream_messages(
    session, prompt, split_criteria={"line": True}
)
for message in stream:
    print(message.message.content)
metisbot.delete_session(session)

Configuration

Before using the client, ensure you configure it with your API key:

metisbot = metisai.MetisBot(api_key=METIS_API_KEY, bot_id=METIS_BOT_ID)

Documentation

For more detailed information about the client's methods and additional functionalities, refer to the Metis Documentation.

Support

If you encounter any issues or have questions, please contact hello@metisai.ir.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

metisai-0.3.4.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

metisai-0.3.4-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file metisai-0.3.4.tar.gz.

File metadata

  • Download URL: metisai-0.3.4.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for metisai-0.3.4.tar.gz
Algorithm Hash digest
SHA256 ac24f0ba07ed65fce926a4ad0e9d9ae067e8e94984b4b525a3d7790c2142df25
MD5 9a14f7853721c054951dcafca93262a8
BLAKE2b-256 beb642ed5a39a9868484af93523a4f0f24758cec516377fa43381170f8172874

See more details on using hashes here.

File details

Details for the file metisai-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: metisai-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for metisai-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 453ffb172c6a847add7bc9085083d2a923f3f8211a1b9caf1c1a4c5b01f4bfa3
MD5 db31ee621e6a8ec1345c9ae126913a6e
BLAKE2b-256 b9b839526401a11a0e92cd96ae174d53553279d77eb0324abcf5f1d2d67bf6d4

See more details on using hashes here.

Supported by

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