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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202601010248.tar.gz
Algorithm Hash digest
SHA256 1635988c9e3a82c425745b2fefb308115271e84f7d9edd4ada3e352579290794
MD5 a7dbc3608790cf9ffde54c3dd7c58d2e
BLAKE2b-256 360d4acb4110df3d3718f112ea3350865f9258d55614aa6deec03549e7e9c5b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202601010248-py3-none-any.whl
Algorithm Hash digest
SHA256 3d02dee7d41273635dcf0c112c06ba65f0feec5720a02c47a44b867ebd8e485a
MD5 0f3b16fc90f725ad6a5b75a1823bfc9b
BLAKE2b-256 cde5cd0eed301a99b6832b2d84f4635ac02729089f620d792e1a67a4af0803bc

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