Skip to main content

SDK for GL Smart Search API backend

Project description

🔍 GL Smart Search SDK 🐍

PyPI Latest Release License

Python SDK for GL Smart Search v2: web search and connector integrations (GitHub, Google Drive, Gmail, Google Calendar).

v1 clients (search, deep_research, authentication email modules) are not included in this package. Use the legacy smart-search-sdk PyPI artifact if you still depend on v1.

Requirements

  • Python 3.11+ (tested on 3.11–3.13)

Installation

pip install gl-smart-search-sdk

GDP Labs internal registry:

pip install gl-smart-search-sdk --index-url https://glsdk.gdplabs.id/gen-ai-internal/simple/

Quick start — Web Search

import asyncio
import os

from gl_smart_search_sdk.web.client import WebSearchClient
from gl_smart_search_sdk.web.models import GetWebSearchResultsRequest


async def main() -> None:
    client = WebSearchClient(base_url=os.environ["GL_SMARTSEARCH_BASE_URL"])
    await client.authenticate(token=os.environ["GL_SMARTSEARCH_TOKEN"])

    request = GetWebSearchResultsRequest(
        query="What is retrieval-augmented generation?",
        result_type="snippets",
        size=5,
    )
    response = await client.search_web(request)
    print(response)


asyncio.run(main())

Quick start — Connectors

import asyncio
import os

from gl_smart_search_sdk.connector.client import ConnectorClient
from gl_smart_search_sdk.connector.models import AppName, ConnectorRequest


async def main() -> None:
    client = ConnectorClient(base_url=os.environ["GL_SMARTSEARCH_BASE_URL"])
    await client.authenticate(token=os.environ["GL_SMARTSEARCH_TOKEN"])

    request = ConnectorRequest(query="meetings next week")
    response = await client.search_connector(
        app_name=AppName.GOOGLE_CALENDAR,
        gl_token=os.environ["GL_CONNECTORS_USER_TOKEN"],
        request=request,
    )
    print(response)


asyncio.run(main())

Environment variables

Variable Required Description
GL_SMARTSEARCH_BASE_URL Yes API base URL
GL_SMARTSEARCH_TOKEN Yes* Bearer token for API calls
GL_SMARTSEARCH_USER_IDENTIFIER CLI User id (CLI / credential flows)
GL_SMARTSEARCH_USER_SECRET CLI User secret (CLI / credential flows)
GL_CONNECTORS_USER_TOKEN Connectors GL Connectors user token
GL_CONNECTORS_DEFAULT_CALLBACK_URL Connectors OAuth callback URL (optional)

* Required for SDK clients unless passed explicitly to authenticate().

Load variables with python-dotenv or your platform’s secret manager before creating clients.

CLI

The package includes the gl-smart-search CLI (web and connector subcommands).

poetry run gl-smart-search --help
poetry run gl-smart-search status

See gl_smart_search_sdk/cli/README.md for full command reference.

Examples

Non-interactive scripts live in the repository under python/examples/:

  • web_search.py — web search, URLs, fetch, snippets, keypoints
  • connector_search.py — connector search and management

API overview (v2)

WebSearchClient

  • search_web — search with snippets, keypoints, or summary
  • search_web_urls — return relevant URLs
  • search_web_map — site map for a base URL
  • fetch_web_page — fetch page content
  • get_web_page_snippets — snippets from a URL
  • get_web_page_keypoints — key points from a URL

ConnectorClient

  • search_connector — search a connected app
  • connect_connector — start connector OAuth flow
  • disconnect_connector — remove connector integration

All clients extend BaseGLSmartSearchClient (authentication, HTTP, streaming helpers).

Documentation

Development

cd python/gl-smart-search-sdk
poetry install
poetry run pytest
poetry run gl-smart-search --version

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

gl_smart_search_sdk-0.0.14b2-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file gl_smart_search_sdk-0.0.14b2-py3-none-any.whl.

File metadata

  • Download URL: gl_smart_search_sdk-0.0.14b2-py3-none-any.whl
  • Upload date:
  • Size: 50.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/2.1.1 CPython/3.12.0 Linux/5.10.0-32-cloud-amd64

File hashes

Hashes for gl_smart_search_sdk-0.0.14b2-py3-none-any.whl
Algorithm Hash digest
SHA256 333e5584b16ef5cfb6ce0a7d4e1239db36ecc2533357510e879a8066a227c289
MD5 93dffcfc7b3c1a49db7b19e9b94d1994
BLAKE2b-256 db907598acca77529c882d8f33721ddbf840bf5ee1a9c8c8fe5f53ab76cae60f

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