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-0.0.30.dev29302392.tar.gz (186.7 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-0.0.30.dev29302392-py3-none-any.whl (125.6 kB view details)

Uploaded Python 3

File details

Details for the file ragbits_core-0.0.30.dev29302392.tar.gz.

File metadata

File hashes

Hashes for ragbits_core-0.0.30.dev29302392.tar.gz
Algorithm Hash digest
SHA256 0e4cc377d7f5f125cb46d6e965882586366ea28b7b9a87fdaea0d182e8017630
MD5 27d53ee7569d2413d1bccc369317e452
BLAKE2b-256 923f23faaabc40eee694cb8cf5d37022fcbb35e35ba175346cd4be0bcb549c94

See more details on using hashes here.

File details

Details for the file ragbits_core-0.0.30.dev29302392-py3-none-any.whl.

File metadata

File hashes

Hashes for ragbits_core-0.0.30.dev29302392-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f752d1665149dd7f6395b9982bb3c6a9e80979171f8f3172bafa06636d8c04
MD5 5010758e64fbc39d4dded66956b0de10
BLAKE2b-256 3ea140410fa46d43e5c74600cf296f576c0577e61c78f01ef5199b0a54a0ee04

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