This release is a pre-release and may not be stable for production use.
Harness FME Python Configs SDK
Overview
Harness FME Python Configs SDK is designed to serve standalone, versioned configuration objects in Python applications.
Compatibility
This SDK is compatible with Python 3.7 and higher.
Getting started
Below is a simple example that describes the instantiation and most basic usage of our SDK:
Run pip install splitio_configs_client
from splitio_configs import ConfigsClient, TimeoutException, Target
client = ConfigsClient('YOUR_SDK_KEY')
try:
client.block_until_ready()
except TimeoutException:
# SDK_READY_TIMED_OUT: evaluations will return the fallback config or a Config with variant "control".
pass
# Without target: returns the default variant of the config
default_config = client.get_config('CONFIG_NAME')
print(default_config.variant) # example: 'v1'
print(default_config.value) # example: {'prompt': 'Hello world', 'temperature': 0.5}
# With target: evaluates targeting rules for the given key
target = Target('user-123')
config = client.get_config('CONFIG_NAME', target)
print(config.variant, config.value)
The SDK also support asyncio, see below example:
from splitio_configs import ConfigsClientAsync, TimeoutException, Target
async def main():
client = ConfigsClientAsync('YOUR_SDK_KEY')
try:
await client.block_until_ready()
except TimeoutException:
# SDK_READY_TIMED_OUT: evaluations will return the fallback config or a Config with variant "control".
pass
# Without target: returns the default variant of the config
default_config = await client.get_config('CONFIG_NAME')
print(default_config.variant) # example: 'v1'
print(default_config.value) # example: {'prompt': 'Hello world', 'temperature': 0.5}
# With target: evaluates targeting rules for the given key
target = Target('user-123')
config = await client.get_config('CONFIG_NAME', target)
print(config.variant, config.value)
asyncio.run(main())
AI Configs
SDK supoprt get_ai_config call to fetch the AI agents configurations, the ai data is parsed through a built-in parser, however, the SDK allows to pass a custom parser.
Example below using the built-in parser
from splitio_configs import ConfigsClient, TimeoutException, Target, LlmCallParser
client = ConfigsClient('YOUR_SDK_KEY')
try:
client.block_until_ready()
except TimeoutException:
# SDK_READY_TIMED_OUT: evaluations will return the fallback config or a Config with variant "control".
pass
parser = LlmCallParser()
# With target: evaluates targeting rules for the given key
target = Target('user-123')
ai_config = client.get_ai_config('CONFIG_NAME', parser, target)
# config standard data
print(ai_config.variant, ai_config.value)
# ai config data
print(ai_config.parsed_value.provider)
print(ai_config.parsed_value.model)
print(ai_config.parsed_value.system_prompt)
print(ai_config.parsed_value.user_prompt)
print(ai_config.parsed_value.max_tokens)
print(ai_config.parsed_value.temperature)
Example below using a custom parser
from splitio_configs import ConfigsClient, TimeoutException, Target, Parse
class MyLlmCall(object):
def __init__(self, model, temperature):
self.model = model
self.temperature = temperature
class MyParser(Parser):
def parse(self, raw):
return MyLlmCall(raw.get("model"), raw.get("temperature"))
client = ConfigsClient('YOUR_SDK_KEY')
try:
client.block_until_ready()
except TimeoutException:
# SDK_READY_TIMED_OUT: evaluations will return the fallback config or a Config with variant "control".
pass
my_parser = MyParser()
# With target: evaluates targeting rules for the given key
target = Target('user-123')
ai_config = client.get_ai_config('CONFIG_NAME', my_parser, target)
# config standard data
print(ai_config.variant, ai_config.value)
# ai config data
print(ai_config.parsed_value.model)
print(ai_config.parsed_value.temperature)
Please refer to our official docs to learn about all the functionality provided by our SDK and the configuration options available for tailoring it to your current application setup.
Submitting issues
The Split team monitors all issues submitted to this issue tracker. We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.
License
Licensed under the Apache License, Version 2.0. See: Apache License.
Metadata
Release files for splitio-configs 1.0.0b4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| splitio_configs-1.0.0b4.tar.gz | 29.2 kB | Without provenance | Details |
Release files / splitio_configs-1.0.0b4.tar.gz
| Download URL | splitio_configs-1.0.0b4.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9d3309492ecda2af77beba2b87fc994bd142de06f08765d086816402fd1e5b2
|
|
BLAKE2b-256 checksum How to use checksums |
6e876eb36687ff2cbb2725dfb14a5b862592207b7d6c2b784dcbbefe08aa9106
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Security for splitio-configs 1.0.0b4
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.