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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202602190302.tar.gz
Algorithm Hash digest
SHA256 79a3d3b33e72fd594c7aab0b95f0fb29e4604587bd1b4520066431800ef95e0a
MD5 94d130dd9ead98f793434570134bdf03
BLAKE2b-256 a3d500740c86432f2384469adea8dcf6531487d4221c0c561ae20eab992c6915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202602190302-py3-none-any.whl
Algorithm Hash digest
SHA256 974cec6f07524c53396db2c04733453d7903fe4cda3f7712744fe344aa82decb
MD5 4886d166afe4b8e6b6c338466457527c
BLAKE2b-256 5eb867b0dd63c6259758963b5f8b6e027374fd382b1c26db7c492f5b2d7ec780

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