Profiles#

Profiles are containers for credentials for a remote service. See:

In this section

Profiles are also used when configuring model monitoring. See Configuring TimescaleDB and Kafka for model monitoring.

Model provider profiles#

Model provider profiles define credentials and environment variables for remote-model providers (for predictions).

OpenAI profile#

open_ai_profile = OpenAIProfile(
    name="openai_profile",
    api_key=os.environ.get("OPENAI_API_KEY"),
    organization=os.environ.get("OPENAI_ORG_ID"),
    project=os.environ.get("OPENAI_PROJECT_ID"),
    base_url=os.environ.get("OPENAI_BASE_URL"),
    timeout=os.environ.get("OPENAI_TIMEOUT"),
    max_retries=os.environ.get("OPENAI_MAX_RETRIES"),
)

project.register_datastore_profile(open_ai_profile)
model_url = f"ds://openai_profile/model-name"

See also:

Hugging Face#

profile = HuggingFaceProfile(
    name=profile_name,
    task="image-classification",
    token=os.environ.get("HF_TOKEN"),
    device=os.environ.get("HF_DEVICE"),
    device_map=os.environ.get("HF_DEVICE_MAP"),
    trust_remote_code=os.environ.get("HF_TRUST_REMOTE_CODE"),
)

# Register the profile with the project
project.register_datastore_profile(profile)

See also:

Source and target profiles#

RabbitMQ#

profile = DatastoreProfileRabbitMQ(
    name="my-profile",
    url="amqp://host:5672",
    exchange_name="my-exchange",
    queue_name="my-queue",
    num_workers=4,
)

# add this profile to a function with:
function.add_rabbitmq_trigger(url="ds://my-profile")

See also

Kafka#

profile = DatastoreProfileKafkaStream(
    name="profile-name", brokers="localhost", topic="topic_name"
)
# add this profile to a function with:
target = KafkaSource(path="ds://profile-name")

See also