Skip to main content

Krypton ML

Krypton ML is a simple ML model serving framework with an emphasis on a config-driven approach. It's designed to make deploying machine learning models as API endpoints quick and easy.

Note: This project is currently in the experimental stage and only supports LangChain invocation.

Author: Varun Kruthiventi
Website: kryptonhq.com
PyPI Package: krypton-ml
GitHub Repository: krypton-ml

Features

  • Config-driven approach to model deployment
  • Easy integration with LangChain. More ML frameworks coming soon!
  • Support for text completion and chat-based chains currently for LangChain
  • Simple API deployment from configuration files

Installation

You can install Krypton ML using pip:

pip install krypton-ml

Usage

  1. Crate a LangChain model(chain) and save it as a Python file (e.g., langchain_example/app.py).
  2. The app.py should have a valid chain callable that can be invoked by Krypton framework.
  3. Create a configuration file (e.g., config.yaml) for your model:
krypton:
  models:
    - name: langchain-example # Name of the model
      type: langchain # Currently only LangChain is supported
      module_path: ./examples # Path to the directory containing the parent module
      callable: langchain_example.completion.chain # <parent_module>.<module>.<callable>
      endpoint: /langchain-example # API endpoint for the model
  server:
    host: 0.0.0.0 # Host to run the server on
    port: 8000 # Port to run the server on
  1. Run the Krypton ML server with your config file:
krypton config.yaml

This will start a server on http://0.0.0.0:8000 with the specified model endpoint.

Examples

Check out the examples folder in the repository for LangChain and Ollama based examples:

  1. Text completion chain
  2. Chat-based chain

These examples demonstrate how to deploy LangChain models as API endpoints using Krypton ML's config-driven approach.

Running Examples with Docker

cd examples
docker compose up -d

Pull the llama3.2:1b model in Ollama container

container_id=$(sudo docker ps | grep ollama | awk '{print $1}')
docker exec -it $container_id ollama pull llama3.2:1b

Test the example langchain endpoint which completes the text

curl -X 'POST' \
  'http://0.0.0.0:5000/langchain/llama3.2/completion' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"topic": "Iron man"}'

You should see the text completion as a response.

Contributing

We welcome contributions to Krypton ML! Please feel free to submit issues, fork the repository and send pull requests.

License

This project is licensed under the Apache License 2.0 License - see the LICENSE file for details.

Disclaimer

Krypton ML is currently in an experimental stage. Use in production environments is not recommended without thorough testing and validation.

For more information, visit kryptonhq.com or check out the GitHub repository.

Release files for krypton-ml 0.1.8

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

Source distribution (sdist)

Source distribution for krypton-ml 0.1.8
File Size Uploaded
krypton_ml-0.1.8.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for krypton-ml 0.1.8
File Interpreter ABI Platform
krypton_ml-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 29.2 kB

Release files / krypton_ml-0.1.8.tar.gz

Download URL krypton_ml-0.1.8.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
865838aba5e0ec36421bc83b6ee0881e3a050cc01d3791fb3e92e479de8c3ff8
BLAKE2b-256 checksum
How to use checksums
002aaee0b84799b63a9acdf34ea031f395b4af6b54fe1949c7e91911aa648749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.7 Linux/6.5.0-1025-azure

Release files / krypton_ml-0.1.8-py3-none-any.whl

Download URL krypton_ml-0.1.8-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f1b4a525cf8b9279db084d061a7c8d0fe7400c1162f6711b61be234ef8b166b
BLAKE2b-256 checksum
How to use checksums
326c11d24ed1d9c57d4f574824afc2144b5c18929f7feb227b882940081465fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.7 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

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