Skip to main content

Codicent Python Library

This library provides a Python interface to the Codicent API.

Installation


To install using pip, run:

pip install codicent-py

For development installation from source:

pip install git+https://github.com/izaxon/codicent-py.git

To use this library, simply import it into your Python script:

from codicentpy import Codicent

Usage


Initialization

Create a Codicent object with your API token and optional SignalR host:

codicent = Codicent("YOUR_API_TOKEN")

Uploading a file

Upload a file to Codicent:

file_id = codicent.upload(open("example.txt", "rb"))
print(file_id)

Posting a message

Post a message to Codicent:

message_id = codicent.post_message("Hello, world!", type="info")
print(message_id)

Getting messages

Get a list of messages from Codicent:

messages = codicent.get_messages(start=0, length=10)
print(messages)

Get AI chat reply

Sends a message to the Codicent chat (AI) and waits for the reply:

reply = codicent.get_chat_reply("What can you help me with?")
print(reply)

Methods

__init__

Initialize the Codicent object with a Codicent API token.

upload

Upload a file to Codicent.

  • file: The file to upload.

Returns the ID of the uploaded file.

post_message

Post a message to Codicent.

  • message: The message to post.
  • parent_id: The ID of the parent message (optional).
  • type: The type of message (default: "info").

Returns the ID of the posted message.

get_messages

Get a list of messages from Codicent.

  • start: The starting index (default: 0).
  • length: The number of messages to retrieve (default: 10).
  • search: A search query (optional).
  • after_timestamp: A timestamp to retrieve messages after (optional).
  • before_timestamp: A timestamp to retrieve messages before (optional).

Returns a list of message objects.

get_chat_reply

Sends a message to the Codicent chat (AI) and waits for the reply.

  • message: The message to send.

post_chat_reply

Posts a message to the Codicent AI chat and returns the reply.

  • message: The message to send.

Returns a dictionary with:

  • id: The message ID.
  • content: The reply message content.

Running Tests

To run tests, first install the required dependencies:

pip install -r requirements.txt

Then execute:

pytest

Building

To build the package, run:

python setup.py sdist bdist_wheel

Metadata

Release files for codicent-py 1.3.5

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

Source distribution (sdist)

Source distribution for codicent-py 1.3.5
File Size Uploaded Provenance Actions
codicent_py-1.3.5.tar.gz 5.3 kB Without provenance Details for codicent_py-1.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codicent-py 1.3.5
File Interpreter ABI Platform Actions
codicent_py-1.3.5-py3-none-any.whl Python 3 none any Details for codicent_py-1.3.5-py3-none-any.whl

Total release size: 10.7 kB

Release files / codicent_py-1.3.5.tar.gz

Download URL codicent_py-1.3.5.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ebba98dffac8ce19830e78c2cb45e389e02f6e9fae1fc4c900359ba8be7df52c
BLAKE2b-256 checksum
How to use checksums
4496f211e7ec31cb686f9709c6173067b5432b5df87ad7846492ac2955bea1a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.8

Release files / codicent_py-1.3.5-py3-none-any.whl

Download URL codicent_py-1.3.5-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f35f16873fe8829a40bea2c3930dc79abb16aa9e34c82033831ee8eb0e5823b2
BLAKE2b-256 checksum
How to use checksums
2f7d9cff41f9b1c95329c460caac1a7ab8381995cc1ce8bb0edb72194c04e9a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.8

Security for codicent-py 1.3.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.

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