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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ragbits_core-1.4.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2726e7cc9cb74e105745b8761d37a86540b5a92c76cf1b43ee393608dd2e630a
MD5 6d6007855f3b1af719860a787d13fff2
BLAKE2b-256 17e07494b2c807be7e79229ff3773d8393b9e4df7af36cc19bfe7d0956be2499

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ragbits_core-1.4.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35605f7210300ec54748f1f50df0f8064ce42e05c5ef90489d342449c0954bdb
MD5 1a8dbddfcbbae7fd0e40147b916930d1
BLAKE2b-256 4b60abf301396836aeffedb5b306e69b7b15192a2f2cc475d9408675978739ce

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