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.6.2.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-1.6.2-py3-none-any.whl (125.4 kB view details)

Uploaded Python 3

File details

Details for the file ragbits_core-1.6.2.tar.gz.

File metadata

  • Download URL: ragbits_core-1.6.2.tar.gz
  • Upload date:
  • Size: 186.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for ragbits_core-1.6.2.tar.gz
Algorithm Hash digest
SHA256 6a15c23a68577865ef234c9ed076d6c774ce806daf0cf49714a86025e43f520a
MD5 b290c552ff3d1136b42f21b5f1df297e
BLAKE2b-256 9f4be4572f85b2384aac768a213e55b07cb240ab8e6319e62ac7f1f23613cf24

See more details on using hashes here.

File details

Details for the file ragbits_core-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: ragbits_core-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 125.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for ragbits_core-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 72c9e5659ae0c3ff7079e9376d76e4928550bcf28f3370422c828839c5cb1c5d
MD5 ab1de771e329635cd6825d2881b6202e
BLAKE2b-256 86fe891525e6742b172af7d5e7b1f80a7ee6c20decc7e950fe61c0346e3a2601

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