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

This version

1.4.0

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.tar.gz (185.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.4.0-py3-none-any.whl (124.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ragbits_core-1.4.0.tar.gz
Algorithm Hash digest
SHA256 93079ffab24bad756d040ed4a891f8336b09357cde29e52d31835a6170c1f8c0
MD5 794f3ee1b23be145d3de56fb9942dc24
BLAKE2b-256 e6f5d4557b776fbb602eb96435396b42e1a1d106c8d3e930566de9ed98c87423

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ragbits_core-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3637e560d6a7c447c44cc9761862b42dcaeff3030f7d1c4356d9d977cf725eb
MD5 12ae29fffa17ce954a78539f72ea6738
BLAKE2b-256 4d591543b2c3f55182f3bfb53649a1c0037330a9fb90e2daea63b7c52895fcdf

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