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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202603070252.tar.gz
Algorithm Hash digest
SHA256 44fc59e6118c204c243396f8f71f4a953ab9464577c0e816a08f5d2152207f3f
MD5 406be2e8047e086d486586a56dd5b4e1
BLAKE2b-256 a24750c2a24059f4dd21dc37a03555e0cf16f61516b8b1b44a98603b7c4dd62f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202603070252-py3-none-any.whl
Algorithm Hash digest
SHA256 5320bfd456b34d838e83a976ad6e803db43748702190435c186b733d47354c58
MD5 a457692bdb15de3e19ef07676ba0ace4
BLAKE2b-256 eece3e58b5aacd2d1a63b85b29a1c34da5bdaa122402844531c8fa0c4f4a46b9

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