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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202602261352.tar.gz
Algorithm Hash digest
SHA256 6da9bb62b32d855426e650a45b673d24b6936f6fc75349bd397b998000e97b37
MD5 3a306631ec04fa39ad341b136182d75d
BLAKE2b-256 2ef7d5824dfca92e9beeae1885826ff424daa4b10f14113d17846c2c610b67de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ragbits_core-1.4.0.dev202602261352-py3-none-any.whl
Algorithm Hash digest
SHA256 a6fa2f9b18190a78da38ee8f356363111be56a71a9f88c8fa8a9e35ea16f4962
MD5 e16943cac89c381fba695ed8b5972f18
BLAKE2b-256 5fdab1bf636a4f1fd1553aed2c63a087c70ee0b393d306f45fdfc47d4ccd3572

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