deepsights-api

Python library for the DeepSights APIs


License
Apache-2.0
Install
pip install deepsights-api==1.0.3

Documentation

🤖💡 deepsights-api

PyPI Changelog Tests License

This is the official Python client library for the DeepSights API.

The library has been built and tested on Python 3.10 - 3.12. Please channel any feedback or issues via the github page.

Scope

deepsights-api bundles access to various subsystems.

Document Store

The Document Store hosts all customer-owned documents, such as presentations and reports. The documentstore API exposes lifecycle management, search and access to documents.

Content Store

The Content Store holds public and paid 3rd party content, including industry news and secondary sources. The contentstore API exposes search and access to this content.

User Client

The User Client serves to impersonate existing platform users with their access permissions. The userclient API supports obtaining AI-generated answers and reports in reponse to business questions.

Getting started

Installation

Install this library using pip; we recommend installing it in a virtualenv.

pip install deepsights-api

API keys

Contact us to obtain your API key(s) (may require commercial add-on).

API Key Scope
DEEPSIGHTS Required to use deepsights-api and the documentstore functions
CONTENTSTORE Optional key to access the contentstore functions
MIP Optional key to access the userclient functions for customers utilizing the core Market Logic platform

Note that your API key may be authorized to access only a subset of the API endpoints.

Configure your api keys either in your environment, or provide it as an argument to the API constructor.

DEEPSIGHTS_API_KEY = <your DeepSights API key>
CONTENTSTORE_API_KEY = <your ContentStore API key; optional>
MIP_API_KEY = <your MIP API key; optional>

then

import deepsights

# with keys from environment
ds = deepsights.DeepSights()

# OR with explicit key
ds = deepsights.DeepSights(
    ds_api_key="<your DEEPSIGHTS API key>",
    cs_api_key="<your CONTENTSTORE API key>", 
    mip_api_key="<your MIP API key>"
)

Hello, world

To retrieve an answer from DeepSights:

import deepsights

# with API keys from environment
ds = deepsights.DeepSights()

# obtain the user client; you will need an actual user's email here!
uc = ds.get_userclient("john.doe@acme.com")

# obtain an answer
response = uc.answers.create_and_wait("What are emerging food consumption moments for Gen Z?")

# returned data are pydantic objects
print(response.answers[0].text)

# you can retrieve the supported properties via schema_human()
print(response.schema_human())

See main.py for more examples. Note that all non-trivial return value from DeepSights API functions are pydantic objects.

Documentation

Access the documentation on github.