Skip to main content

A Python library for interacting with Rally.io services

Project description

Rally.io Python Package

A Python package for interacting with Rally.io services, including search and RAG (Retrieval Augmented Generation) capabilities.

Installation

Quick Install (Recommended)

Simply use pip to install the package:

pip install rallyio

Development Installation

If you want to install the package in development mode or contribute to the project:

  1. Clone the repository:
git clone https://github.com/jatinarora2409/rallyio.git
cd rallyio
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows, use: venv\Scripts\activate
  1. Install the package in development mode:
pip install -e .

Usage

Search Tool

import rallyio

# Initialize the search tool
search_tool = rallyio.get_search_tool(
    project_id="your-google-cloud-project-id",
    location="us-central1",
    index_endpoint_id="your-index-endpoint-id"
)

# Perform a search
results = search_tool.search(query_vector=[0.1, 0.2, 0.3])  # Your vector here
print(results)

# Get information about the index
index_info = search_tool.get_index_info()
print(index_info)

RAG Tool

import rallyio
import inspect

# Initialize the RAG function with custom names
my_rag = rallyio.get_rag_function(
    project_id="your-google-cloud-project-id",
    rag_corpus_id="your-rag-corpus-id",
    location="us-central1",  # optional, defaults to "us-central1"
    function_name="ask_ai",  # optional, customizes the function name
    parameter_name="question"  # optional, customizes the parameter name
)

# The function's name and parameter will be customized
print(my_rag.__name__)  # Output: ask_ai
print(inspect.signature(my_rag))  # Output: (question: str) -> str

# Use the RAG function with the custom parameter name
response = my_rag(question="What is the capital of France?")
print(response)

# You can also use the default function without custom names
default_rag = rallyio.get_rag_function(
    project_id="your-google-cloud-project-id",
    rag_corpus_id="your-rag-corpus-id"
)
print(default_rag.__name__)  # Output: function
print(inspect.signature(default_rag))  # Output: (query: str) -> str

# Use the default function
response = default_rag(query="Tell me about quantum computing")
print(response)

Requirements

  • Python 3.8 or higher
  • Google Cloud credentials configured (for RAG functionality)
  • Required Python packages (automatically installed with the package):
    • requests
    • google-cloud-aiplatform
    • google-generativeai

Google Cloud Setup

To use the RAG functionality, you need to:

  1. Have a Google Cloud project set up
  2. Enable the Vertex AI API
  3. Create a RAG corpus in your project
  4. Set up authentication:
    # Install Google Cloud CLI
    # Then authenticate:
    gcloud auth application-default login
    

Development

To run tests:

pytest

To format code:

black .

License

[Your chosen license]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rallyio-0.1.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rallyio-0.1.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file rallyio-0.1.3.tar.gz.

File metadata

  • Download URL: rallyio-0.1.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for rallyio-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d512c27a936dfae333075916cfad468e5d2807e73e0da6ffab6e661b6ae32e31
MD5 30eb3707e1e159ddd8c8b8c079fe276b
BLAKE2b-256 102c58a0c2415d966bca89d9262f563653af7c5a54bbdabd9c6bff5d80900503

See more details on using hashes here.

File details

Details for the file rallyio-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rallyio-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for rallyio-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1a756d242505f3b19a722e379a158fd72ceedb14031b94c31c38d489b8cf14f9
MD5 09cf65e6625c52721840c5160a074938
BLAKE2b-256 5e83c5ad65d5c73f55aa9eb1b4914543a77c78bdcd771ad81caaa787413b99a0

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