Skip to main content

Building blocks for rapid development of GenAI applications

Project description

Ragbits Core

Ragbits Core is a collection of utilities and tools that are used across all Ragbits packages. It includes fundamentals, such as utilities for logging, configuration, prompt creation, classes for comunicating with LLMs, embedders, vector stores, and more.

Installation

pip install ragbits-core

Quick Start

import asyncio

from pydantic import BaseModel
from ragbits.core.prompt import Prompt
from ragbits.core.llms.litellm import LiteLLM


class Dog(BaseModel):
    breed: str
    age: int
    temperament: str

class DogNamePrompt(Prompt[Dog, str]):
    system_prompt = """
    You are a dog name generator. You come up with funny names for dogs given the dog details.
    """

    user_prompt = """
    The dog is a {breed} breed, {age} years old, and has a {temperament} temperament.
    """

async def main() -> None:
    llm = LiteLLM("gpt-4o")
    dog = Dog(breed="Golden Retriever", age=3, temperament="friendly")
    prompt = DogNamePrompt(dog)
    response = await llm.generate(prompt)
    print(response)


if __name__ == "__main__":
    asyncio.run(main())

Documentation

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

ragbits_core-1.4.0.dev202512151244.tar.gz (186.7 kB view details)

Uploaded Source

Built Distribution

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

ragbits_core-1.4.0.dev202512151244-py3-none-any.whl (125.6 kB view details)

Uploaded Python 3

File details

Details for the file ragbits_core-1.4.0.dev202512151244.tar.gz.

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202512151244.tar.gz
Algorithm Hash digest
SHA256 39dc7c3325eebb7e4f40f61fb055f78c35e46ce012adcd23da435b7e5a7a1aac
MD5 db207fa3e12af592b7109fd479d95f78
BLAKE2b-256 cacf07391e5e34f81b4e20dc772511c36d0f8b52ef12b8f63499f5f4196c9cd2

See more details on using hashes here.

File details

Details for the file ragbits_core-1.4.0.dev202512151244-py3-none-any.whl.

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202512151244-py3-none-any.whl
Algorithm Hash digest
SHA256 4b2b1b357b1a3279a2888b5c24813a0f6c61d6280702137d71d88b63d1899523
MD5 d7ce8d13e502091361975330fda6ceed
BLAKE2b-256 0118cad776244d7abd251fa29f13383d28e88dc4c43f70414e24c470c99d912c

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