Skip to main content

This repository includes base classes and mixins for the Swarmauri framework.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_base

---

Swarmauri Base

swarmauri_base is where Swarmauri's dynamic component schema machinery lives. ComponentBase combines Pydantic JSON support, YAML/TOML serialization mixins, and DynamicBase registration so components can preserve concrete subclass identity across configuration files, APIs, factories, queues, and databases.

When a subclass is registered with ComponentBase.register_type(...), fields typed with SubclassUnion[...] can hydrate that concrete subclass from a serialized type discriminator. The same component can be dumped to JSON, YAML, or TOML and loaded again without becoming an untyped dictionary.

from typing import Literal
from pydantic import BaseModel
from swarmauri_base.ComponentBase import ComponentBase
from swarmauri_base.DynamicBase import SubclassUnion


@ComponentBase.register_model()
class StoreConfig(ComponentBase):
    type: Literal["StoreConfig"] = "StoreConfig"
    name: str


@ComponentBase.register_type(StoreConfig, "SqliteStoreConfig")
class SqliteStoreConfig(StoreConfig):
    type: Literal["SqliteStoreConfig"] = "SqliteStoreConfig"
    path: str


class StoreEnvelope(BaseModel):
    store: SubclassUnion[StoreConfig]


envelope = StoreEnvelope.model_validate_json(
    '{"store":{"type":"SqliteStoreConfig","name":"local","path":"./data.db"}}'
)
assert isinstance(envelope.store, SqliteStoreConfig)

Getting Started

Installing Swarmauri Base from pypi

To start developing with the Core Library, include it as a module in your Python project. Ensure you have Python 3.10 or later installed.

pip install swarmauri-base

Example Usage:

# Example of using the base class
from swarmauri_base.llms.LLMBase import LLMBase

class MyConcreteClass(LLMBase):
    
    pass

Features

agents

chains

chunkers

conversations

dataconnectors

distances

documents

document_stores

embeddings

factories

Factories can accept serialized component specs and hydrate concrete subclasses through SubclassUnion[...], avoiding brittle manual switches over type.

image_gens

llms

  • LLMBase.py: Base class for large language models.

logging

measurements

messages

ocrs

parsers

pipelines

prompts

prompt_templates

schema_converters

service_registries

state

stt

  • STTBase.py: Base class for speech-to-text functionalities.

swarms

task_mgmt_strategies

toolkits

tool_llms

tools

transports

tts

  • TTSBase.py: Base class for text-to-speech functionalities.

vectors

vector_stores

vlms

  • VLMBase.py: Base class for visual language models.

Contributing

Contributions are welcome! If you'd like to add a new feature, fix a bug, or improve documentation, kindly go through the contributions guidelines first.

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

swarmauri_base-0.10.1.dev2.tar.gz (80.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_base-0.10.1.dev2-py3-none-any.whl (150.0 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_base-0.10.1.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_base-0.10.1.dev2.tar.gz
  • Upload date:
  • Size: 80.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_base-0.10.1.dev2.tar.gz
Algorithm Hash digest
SHA256 fdc92837bc21dbdf52c9985b6a46140943716232d3c9b8600b5a719e75a0b18a
MD5 2ae8fabeb2f85d98bb790102656883a5
BLAKE2b-256 3bc7bac344f98ae9e46836fbeabb904251122aa06e1b399cc316e2de43f10e93

See more details on using hashes here.

File details

Details for the file swarmauri_base-0.10.1.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_base-0.10.1.dev2-py3-none-any.whl
  • Upload date:
  • Size: 150.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_base-0.10.1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 46f8c3c5fe9d18ff6a9a65d379228851e6d81250e41c422d26fe4161db85ecad
MD5 a6a0e5b8931371f08ac995ff73d1a41f
BLAKE2b-256 ee90c0abf84976d05fdbec656aabaf45aea60c29dcb2bff3f1f6b121ccc07a2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page