CrocoTiger SDK
Project description
CrocoTiger SDK
This is the official Python SDK for CrocoTiger API. It allows developers to easily integrate CrocoTiger's powerful semantic fence capabilities into their Python applications.
Usage
To use the CrocoTiger SDK, first install it via pip:
pip install crocotiger_sdk
Then, you can import the SDK and start using it in your Python code:
from crocotiger.sdk import SDK
client = SDK(base_path="http://localhost:8000/api/v1/")
project = client.get_project_client().find_one(1)
print(project)
Download a sample docker image
CrocoTiger offers a development edition docker image with sample projects for development and testing purposes.
- Install docker
- Do
docker pull public.ecr.aws/k9l9y2x7/tekdatum/croco-tiger-developer-edition:1.1 - Do
docker run -d --name croco_tiger_container --gpus all -p 8000:8000 public.ecr.aws/k9l9y2x7/tekdatum/croco-tiger-developer-edition:1.1
How to use
The SDK provides various clients to interact with different parts of the Engine API. Below are examples of how to use these clients.
Project Client
To interact with projects, you can use the ProjectClient. Here's an example of how to retrieve a project by its ID:
Available methods:
create: Create a new project.find_all: Retrieve all projects. This method supports pagination throughlimitandoffsetparameters.update: Update an existing project.delete: Delete a project by its ID.find_one: Retrieve a single project by its ID.upload_chained_zip: (Not implemented) Upload a chained zip file for the project.
Usage:
from crocotiger.sdk import SDK
sdk = SDK()
project_client = sdk.get_project_client()
project = project_client.find_one(1)
print(project)
Custom Settings Client
Custom settings client allow you to manage the LLM API Keys for your projects.
Available methods:
update_custom_settings: Update the custom settings with new LLM API keys.clear_llms_keys: Clear all LLM API keys from the custom settings.find_custom_settings: Retrieve the current custom settings.
Usage:
from crocotiger.sdk import SDK
sdk = SDK()
custom_settings = sdk.get_custom_settings_client().update_custom_settings(
openai_key="sk-xxxx",
gemini_key="gemini-xxxx",
)
custom_settings = sdk.get_custom_settings_client().clear_llms_keys()
custom_settings = sdk.get_custom_settings_client().find_custom_settings()
print(custom_settings)
Builder Client
The Builder Client allows you build and retrieve generated data for your projects.
Available methods:
-
build: Trigger the build process for a project. -
List retrieval methods: these methods allow you to get accept and reject lists samples generated for a project.
find_project_accept_list: Retrieve the accept list for a project.find_project_reject_list: Retrieve the reject list for a project.
-
General retrieval methods: these methods allow you to get all filenames of a certain type for a project.
find_project_logs: Retrieve all logs filename for a project.find_project_testing_metrics: Retrieve testing metrics filename for a project.find_project_validation_metrics: Retrieve validation metrics filename for a project.
-
Specific item retrieval methods: these methods allow you to get the specific file you are looking for by its project id and filename.
find_project_log_by_name: Retrieve a specific log by name for a project.find_project_testing_metrics_by_name: Retrieve a specific testing metrics file by name for a project. You can also pass atesting_summaryfile name to get the corresponding metrics.find_project_validation_metrics_by_name: Retrieve a specific validation metrics file by name for a project. You can also pass avalidation_summaryfile name to get the corresponding metrics.
-
Summary methods:
find_project_testing_summary: Retrieve testing summary for a project.find_project_validation_summary: Retrieve validation summary for a project.
Usage:
from crocotiger.sdk import SDK
sdk = SDK()
builder_client = sdk.get_builder_client()
accept_list = builder_client.find_project_accept_list(1)
print(accept_list)
Fence Client
The Fence Client allows you to validate text against a project's fence rules.
Available methods:
validate: Validate text to check if it complies with the project's fence rules.
Usage:
from crocotiger.sdk import SDK
sdk = SDK()
fence_client = sdk.get_fence_client()
# Validate text for a project (e.g. project_id=1)
validation_result = fence_client.validate(project_id=1, text="Text to validate")
print(f"Valid: {validation_result.valid}")
print(f"Reason: {validation_result.reason_code}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crocotiger_sdk-1.1.0.tar.gz.
File metadata
- Download URL: crocotiger_sdk-1.1.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
467955ba5bf6d15042b2b7042f0c6e7e838e0de7342d8f01a747620349147d8d
|
|
| MD5 |
0c075f8711ab591a753521df014f03cd
|
|
| BLAKE2b-256 |
85e99d229e930f3ab8bc47e291b38ad7276dfc215fcd716468d5c4b02c6cb24d
|
File details
Details for the file crocotiger_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: crocotiger_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ff3ca20944b591fb7e3ee6ac253f62c29e463eafa3b93882260c01919f79775
|
|
| MD5 |
257e52c667f4bc83efd106f1b7d1e5ea
|
|
| BLAKE2b-256 |
cd182c32992c36411fa384cc5f854f956440955dc0ca3c1a2369e1eeb3065016
|