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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.7.0.dev202604280307.tar.gz
Algorithm Hash digest
SHA256 6ab9ec5ee86c812c1277f169f5966cb05220f0e3d5ffb04d3bce0bf274557b1d
MD5 991ef4e2a2e625f9c327518d25dff3bb
BLAKE2b-256 dcef85fd4a42706847770fd25129c7750e993b7d8b2fdc91019610b6c2205c8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.7.0.dev202604280307-py3-none-any.whl
Algorithm Hash digest
SHA256 abb78dc5e51413e90c2d3a02fa3d0ea9b551c603a68c9ab5a0609ebc7376323f
MD5 114dfd11072a90ac472b54238d4731f8
BLAKE2b-256 5d4d7ab36d288b4bd5f55908005b5b57ccefda7e3c3e7e4a73f64084e01f82f5

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