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.7.0.dev202604150306.tar.gz (186.8 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.7.0.dev202604150306-py3-none-any.whl (125.5 kB view details)

Uploaded Python 3

File details

Details for the file ragbits_core-1.7.0.dev202604150306.tar.gz.

File metadata

File hashes

Hashes for ragbits_core-1.7.0.dev202604150306.tar.gz
Algorithm Hash digest
SHA256 bf370ae3e8ba46d30ce946368c4020cd315bade3cf1b9025b88410d6d3b7c9e8
MD5 e5a0c58e18e79d1225ea0749ef58768f
BLAKE2b-256 b29219d7ce8d5d0146103b04090c558101d271c5acf4f3c26d27c9be17ce0e68

See more details on using hashes here.

File details

Details for the file ragbits_core-1.7.0.dev202604150306-py3-none-any.whl.

File metadata

File hashes

Hashes for ragbits_core-1.7.0.dev202604150306-py3-none-any.whl
Algorithm Hash digest
SHA256 26baa1c827162cad2ff8c40b2a10bbbc48db9e1b2c989289b01b11c13037a81a
MD5 f21303647829c5e6404638a96e7c3e24
BLAKE2b-256 cd43a660507ed77dc6ab3abb5e894d65227522d71de27bf0eec794b73ae66188

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