Skip to main content

Arcee Python Client

The Arcee Python client allows you to manage CPT, SFT, DPO, and Merge models on the Arcee Platform.

This client may be used as a CLI by invoking arcee from the terminal, or as an SDK for programmatic use by import arcee in Python.

Learn more at https://docs.arcee.ai

Installation

pip install --upgrade arcee-py

Authenticating

Your Arcee API key is obtained at https://app.arcee.ai

In bash:

export ARCEE_API_KEY=********

In notebook:

import os
os.environ["ARCEE_API_KEY"] = "********"

(Optional) To customize the URL of the Arcee platform:

export ARCEE_API_URL="https://your-url.arcee.ai"

(Optional) To specify an organization to issue requests for:

export ARCEE_ORG="my-organization"

If you do not specify an organization, your default organization will be used. You can change the default in your Arcee account settings.

Upload Context

Upload context for retriever training:

import arcee
arcee.upload_docs("pubmed", docs=[{"doc_name": "doc1", "doc_text": "foo"}, {"doc_name": "doc2", "doc_text": "bar"}])

Upload Finetuning Dataset

Method 1: Via CSV

arcee.upload_instructions_from_csv(
  "finetuning-dataset-name",
  csv_path="./your_data.csv",
  prompt_column="prompt",
  completion_column="completion"
)

Method 2: Via HF Dataset

NOTE: you will need to set HUGGINGFACE_TOKEN in your environment to use this function.

arcee.api.upload_hugging_face_dataset_qa_pairs(
    "my_qa_pairs",
    hf_dataset_id="org/dataset",
    dataset_split="train",
    data_format="chatml"
)

Using the Arcee CLI

You can easily train and use your Domain-Adapted Language Model (DALM) with Arcee using the CLI. Follow these steps post installation to train and utilize your DALM:

Upload Context

Upload a context file for your DALM like,

arcee upload context pubmed --file doc1

Upload all files in a directory like,

arcee upload context pubmed --directory docs

Upload any combination of files and directories with,

arcee upload context pubmed --directory some_docs --file doc1 --directory more_docs --file doc2

Note: The upload command ensures only valid and unique files are uploaded.

Train your DALM:

Train your DALM with any uploaded context like,

arcee train medical_dalm --context pubmed
# wait for training to complete...

DALM Generation:

Generate text completions from a model like,

arcee generate medical_dalm --query "Can AI-driven music therapy contribute to the rehabilitation of patients with disorders of consciousness?"

DALM Retrieval:

Retrieve documents for a given query and to view them or plug into a different LLM like,

arcee retrieve medical_dalm --query "Can AI-driven music therapy contribute to the rehabilitation of patients with disorders of consciousness?"

Contributing

We use invoke to manage this repo. You don't need to use it, but it simplifies the workflow.

Set up the repo

git clone https://github.com/arcee-ai/arcee-python && cd arcee-python
# optionally setup your virtual environment (recommended)
python -m venv .venv && source .venv/bin/activate
# install repo
pip install invoke
inv install

Format, lint, test

inv format  # run black and ruff
inv lint    # black check, ruff check, mypy
inv test    # pytest

Publishing

We publish in this repo by creating a new release/tag in github. On release, a github action will publish the __version__ of arcee-py that is in arcee/__init__.py

So you need to increase that version before releasing, otherwise it will fail

To create a new release

  1. Open a PR increasing the __version__ of arcee-py. You can manually edit it or run inv version
  2. Create a new release, with the name being the __version__ of arcee-py

Manual release [not recommended]

We do not recommend this. If you need to, please make the version number an alpha or beta release.
If you need to create a manual release, you can run inv build && inv publish

Release files for arcee-py 2.0.1

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

Source distribution (sdist)

Source distribution for arcee-py 2.0.1
File Size Uploaded
arcee_py-2.0.1.tar.gz 83.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arcee-py 2.0.1
File Interpreter ABI Platform
arcee_py-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 107.0 kB

Release files / arcee_py-2.0.1.tar.gz

Download URL arcee_py-2.0.1.tar.gz
Size 83.8 kB
Tags Source
SHA-256 checksum
How to use checksums
98730b403eadce8fa5c195760a415a4fc9ad36b10cc854d3f6730fd5e39bc355
BLAKE2b-256 checksum
How to use checksums
003cd084486f389112d6c9ea5935ba3b2aa821a849995eeac65f42d3a9d7f132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / arcee_py-2.0.1-py3-none-any.whl

Download URL arcee_py-2.0.1-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc077e51e5ba1300a80e65186dd72f780e26ff566487992db0857fd7e3c42b7d
BLAKE2b-256 checksum
How to use checksums
c9c7a6cf29ef23d5236f20ae17c4ad8825b7325ab4c7f04d60c6b824b933e2dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.2

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

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