Skip to content

Configure the LLM SDK

This page presents the full range of configuration options for controlling how your data is logged to Comet.

There are additional configuration parameters that are specific to Comet integrations with other tools and frameworks. For details, see the Comet documentation on the relevant integration.

Configure the SDK

The recommended way to configure the SDK is by running comet_llm.init() in you code:

1
2
3
import comet_llm

comet_llm.init()

This will prompt you for your API key and will store it in the Comet config file (.comet.config) so that you don't have to copy and paste your API key every time.

This is not the only way to configure the LLM SDK, you can also use:

  1. Method arguments
  2. Environment variable
  3. Configuration file

Order of precedence for configuration parameters

Comet prioritizes setting configuration parameters in the following order:

  • Arguments passed to code, for example, comet_llm.init(api_key="Your API Key").
  • Environment parameters, for example, export COMET_API_KEY=<Your API Key>
  • A setting in the .comet.config file in your current folder
  • A setting in the .comet.config file in your HOME directory

In other words, an explicit parameter passed to code has top priority, followed by parameters set through environment parameters, followed by a .comet.config file in your current working directory, followed by the .comet.config file in your HOME directory.

Configuration parameters

These parameters control behaviors of the SDK that are not related to logging data.

The table below outlines all the available configuration environment parameters and their corresponding names in the .comet.config file.

Comet Config Section/NameEnvironment Parameter NameDescription
[comet]
api_key
COMET_API_KEYThe API key used for logging data and using the Python API
[comet]
workspace
COMET_WORKSPACEUse this workspace when logging datra
[comet]
project_name
COMET_PROJECT_NAMEUse this project when logging data
[comet]
url_override
COMET_URL_OVERRIDEURL to upload data to, this needs to be updated for on-premise deployments. Defaults to https://www.comet.com/clientlib/.

Environment-only parameters

In addition to the configuration parameters, there are a few special-purpose Comet environment-only parameters. These only operate in the environment, and cannot be set in the configuration:

Environment ParameterDescription
COMET_INIA path to another .comet.config file to take into account
Apr. 29, 2024