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.dev202601170236.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.dev202601170236-py3-none-any.whl (125.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202601170236.tar.gz
Algorithm Hash digest
SHA256 9bfc3f728f7099d141cf945b6d24cb8fc3c7756dac9de914fbd33db77325b047
MD5 66874f0c3bd14223d2e2ba235e0e67fd
BLAKE2b-256 4f5bc13e69a9a117dc7dc98351bb4db6f1479878243559d3fc0b7903ce50f5aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202601170236-py3-none-any.whl
Algorithm Hash digest
SHA256 82047b8063f0ea49c24f6a2dd25bdcf8ca6407e778c2e04c4ef92bfc1672d8e9
MD5 537218537c57bf31670c52470fb53c2e
BLAKE2b-256 49c6358b07a19574a6cb5d261728a3707c6299f356401b959bd60b6573b47145

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