Skip to main content

mara client module

This package provides a Python interface for the MARA conversational agent for cheminformatics.

Installation

pip install mara-client

Usage

To use the MARA client, you need to have an API key. You can create one at https://app.nanome.ai/settings/api-keys.

MARA chats are created using the new_chat method, or retrieved with the get_chat method of the client. You can then interact with the chat using the prompt method. The prompt method returns a ChatResult object, which contains the response from MARA, intermediate messages such as tool runs, and any files that were generated during the conversation. You can download these files using the download_file method of the chat. Chat will be visible as conversations in the MARA web interface, and can be deleted using the delete method.

from mara_client import MARAClient

API_KEY = "..."
URL = "https://nanome.example.com" # optional
client = MARAClient(API_KEY, URL)

chat = client.new_chat()
# or, chat = client.get_chat("chat_id")

result = chat.prompt('Download SDF of aspirin')
print(result.response)
# The SDF file for the compound aspirin has been downloaded successfully. You can access it [here](CHEMBL25.sdf).
print(result.files)
# [ChatFile(id='...', name='CHEMBL25.sdf', size=1203, date=...)]

chat.files.download('CHEMBL25.sdf', 'aspirin.sdf')
# downloaded as aspirin.sdf in current working directory

result = chat.prompt('Calculate chem props')
print(result.response)
# The chemical properties of the compound with ChEMBL ID CHEMBL25 (aspirin) are as follows:
#
# | Property | Value |
# | --- | --- |
# | Molecular Weight (MW) | 180.159 |
# | LogP | 1.310 |
# | Total Polar Surface Area (TPSA) | 63.600 |
# | Hydrogen Bond Acceptors (HBA) | 3 |
# | Hydrogen Bond Donors (HBD) | 1 |
# | Rotatable Bonds (RB) | 2 |

chat.delete()
# remove chat from history, delete associated files and data

Files

The chat object contains a files attribute for working with files.

# Upload a file as part of a prompt
file_path = './example.sdf'
result = chat.prompt('Convert this to SMILES', files=[file_path])

# List all files
file_list = chat.files.list()

# Download a file
file_name = file_list[0].name
chat.files.download(file_name, 'output.sdf')

# Upload a file directly
file_path = './example.sdf'
file = chat.files.upload(file_path)
print(file.id)

Data Tables

The chat object contains a datatables attribute for working with DataTables.

# Create a data table from already uploaded file
csv_file = './example.csv'
datatable: DataTable = chat.datatables.create(csv_file)

# List all data tables
table_list = chat.datatables.list()

# Generate a new DataTable based on Chat context
chat.datatables.generate()

# Run prompt to update/query a datatable
dt_id = datatable.id
chat.datatables.prompt(dt_id, prompt)

# Retrieve a datatable
chat.datatables.get(dt_id)

# View datatable as a pandas Dataframe
df = datatable.dataframe

Metadata

Release files for mara-client 1.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mara-client 1.4.3
File Size Uploaded Provenance Actions
mara_client-1.4.3.tar.gz 5.8 kB Without provenance Details for mara_client-1.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mara-client 1.4.3
File Interpreter ABI Platform Actions
mara_client-1.4.3-py3-none-any.whl Python 3 none any Details for mara_client-1.4.3-py3-none-any.whl

Total release size: 12.3 kB

Release files / mara_client-1.4.3.tar.gz

Download URL mara_client-1.4.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
05e6deb6a559a97ef172889cfaa63a87205d53724a7537f0b938e8aae386b103
BLAKE2b-256 checksum
How to use checksums
721b2e176b392d3ec2967bb26f3d2689f61d07858d5fbdad6130e61fe8d25634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / mara_client-1.4.3-py3-none-any.whl

Download URL mara_client-1.4.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed286712df7bdabe8c3b4c3fe003c4198195665d449ed83a833a8989befe0c8e
BLAKE2b-256 checksum
How to use checksums
d018a6aa69725fadbb991d2a46ef2e19972a2fbbd485662252f1047cc433a331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for mara-client 1.4.3

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.

Release history Release notifications | RSS feed

This release

1.4.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page