Skip to main content

Grip SDK (grip-sdk)

PyPI Version Python 3.10+ CI Pipeline License: MIT Platform

The official developer SDK for Grip AI. Integrate lightning-fast AI Search, real-time token streaming, deep model reasoning, and multi-turn conversational agents into any Python application with a simple, ergonomic interface.


⚡ Installation

Install the official package from PyPI:

pip install grip-sdk

🚀 How to Use

from grip import Grip

client = Grip()

# Ask any query
response = client.query("What are the latest breakthroughs in fusion energy?")

print(response.answer)

# View grounded sources and citations
for source in response.sources:
    print(f"- {source.title}: {source.link or source.url}")

2. Live Token Streaming (SSE)

Stream responses token-by-token with instant terminal or UI rendering:

from grip import Grip

client = Grip()

for chunk in client.stream("Explain gravitational time dilation simply"):
    # Live thinking process
    if chunk.event == "thinking" and chunk.thinking:
        print(f"\n[Reasoning]: {chunk.thinking}\n")
    # Content tokens
    elif chunk.event == "delta" and chunk.delta:
        print(chunk.delta, end="", flush=True)

print()

3. Asynchronous Streaming (AsyncGrip)

Ideal for FastAPI, asyncio, Discord bots, and modern async web frameworks:

import asyncio
from grip import AsyncGrip

async def main():
    async with AsyncGrip() as client:
        async for chunk in client.stream("Summary of quantum error correction"):
            if chunk.event == "delta" and chunk.delta:
                print(chunk.delta, end="", flush=True)
    print()

asyncio.run(main())

4. Multi-Turn Conversational Sessions

Persist context across multiple questions:

from grip import Grip

client = Grip()

# Create a conversation session
session = client.sessions.create(title="Astrophysics Discussion")

# First question
res1 = client.chat("What is the event horizon of a black hole?", session_id=session.session_id)
print(res1.answer)

# Follow-up with retained conversational memory
res2 = client.chat("Can anything escape it once inside?", session_id=session.session_id)
print(res2.answer)

5. Multi-Provider Routing

Switch between search providers dynamically at runtime:

from grip import Grip

client = Grip()

# Query Google AI Search
google_res = client.query("Recent AI news", provider="google")

# Query OpenAI Search
openai_res = client.query("Recent AI news", provider="openai")

# Query Grip Native Engine
grip_res = client.query("Recent AI news", provider="grip")

💻 Command Line Interface (CLI)

grip-sdk includes an interactive CLI available directly in your terminal:

# Instant search from your terminal
grip search "Who discovered Penicillin?"

# Stream answer token-by-token
grip search "Explain superconductivity"

# Launch an interactive multi-turn chat session
grip chat

# List all registered search providers
grip providers

# Inspect version
grip --version

🧪 Interactive Web Playground

Launch the visual test server with a ChatGPT-style dark mode interface:

python examples/test_server.py

Then open http://127.0.0.1:8080 in your browser to test live streaming, thinking reasoning blocks, and conversational sessions interactively.


⚙️ Configuration

Grip SDK works out of the box with zero configuration. You can customize behavior using environment variables or code:

Variable Description Default
GRIP_API_URL Remote Grip Platform API endpoint http://127.0.0.1:8000
GRIP_API_KEY Optional API key for authenticated gateways None
GRIP_DEFAULT_PROVIDER Default AI search provider (google, openai, grip) google
OPENAI_API_KEY Required only when using provider="openai" None
from grip import Grip

# Custom client configuration
client = Grip(
    base_url="https://grip.theshoaib.me",
    api_key="your_api_key",
    provider="google",
    timeout=30.0,
)

📄 License

MIT © Grip AI Platform

Metadata

Release files for grip-sdk 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grip-sdk 0.3.4
File Size Uploaded
grip_sdk-0.3.4.tar.gz 67.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grip-sdk 0.3.4
File Interpreter ABI Platform
grip_sdk-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 158.8 kB

Release files / grip_sdk-0.3.4.tar.gz

Download URL grip_sdk-0.3.4.tar.gz
Size 67.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b1cd0f3883a30f0c8c868295d39f335ec8ec0d5ed1a444598ce51b020aac2348
BLAKE2b-256 checksum
How to use checksums
545d030d357f4c1a729c20e35a9a5233016a8c348cbf08b218137bb369ad23fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / grip_sdk-0.3.4-py3-none-any.whl

Download URL grip_sdk-0.3.4-py3-none-any.whl
Size 91.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f56bd81e9931237c2f8c891e6bee4ce85eb7b1408bd6ca6150fc1a9011585ef
BLAKE2b-256 checksum
How to use checksums
27f4c0fb54f89273a054204c56d902cefd186fdf4bc8b45f229624113c4a7839
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page