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.dev202602130304.tar.gz (186.9 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.dev202602130304-py3-none-any.whl (125.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202602130304.tar.gz
Algorithm Hash digest
SHA256 029576fde06468b8b4f1eab10661378559937ef59fa27590993696a1185a4f88
MD5 fbead1fe6fd460d00da06e7d846710cb
BLAKE2b-256 2293598e9ed258894fa00ee0af693eda77f6eccd2ec9e8329de2cfc42df76dc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202602130304-py3-none-any.whl
Algorithm Hash digest
SHA256 df6498d3cb9b9defb2ccf713cb0db7d2eb2d127ac179417358e8250007b8236b
MD5 667481a1f380877f8ab9c1a97f6f8758
BLAKE2b-256 5618f51afa2690781e6b46bdf206e67133d527ca6ab2eea127dc709a08e64a52

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