Python SDK

The eGain API client SDK for Python offers a modern, type-safe interface for integrating with eGain’s Knowledge Portal Manager, AI Services, and Ingestion APIs.

License

The following licenses are required to use the SDK:

  • If the user is an agent, then the Knowledge + AI license is required.
  • If the user is a customer, the Self-Service and Advanced Self-Service licenses must be available.

API Resource Limits

The following Resources have predefined limits for specific access attributes for Enterprise use.

ResourceAttributeEnterprise
Article Reference LimitsNumber of attachments used in any article50
Number of custom attributes in an article15
Number of publish views used in an article version20
Topic Reference LimitsUser-defined topics in a department50000
Depth of topics20
Topics at any level2500
Number of custom attributes in a topic15
Portal Reference LimitsTag categories in a portal15
Topics to be included in a portal2500
Number of articles to display in announcements25
Maximum related articles in portal setting100
Usage links and link groups setup for a portal25

SDK Example Usage

Retrieve API

Copy
Copied
# Synchronous Example
from egain_api_python import Egain
import os


with Egain(
    access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
) as egain:

    res = egain.aiservices.retrieve.retrieve_chunks(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
        "PROD-1234": [
            "PROD-2000",
            "PROD-2003",
        ],
        "PROD-2005": [
            "PROD-2007",
        ],
    }, channel={
        "name": "Eight Bank Website",
    })

    # Handle response
    print(res)