Skip to main content

Python library for the DeepSights APIs

Project description

🤖💡 deepsights-api

This is the official Python client library for the DeepSights API. The library is considered in beta phase, please channel any feedback or issues via the official github page.

deepsights-api supports access to the DeepSights API for retrieving answers and reports, as well as searching and managing internal documents. It also supports the ContentStore API for direct searching of news articles and secondary reports.

The library has been built and tested on Python 3.10 - 3.12.

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 (may require commercial add-on). Then, 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>

then

import deepsights

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

# with explicit key
ds = deepsights.DeepSights(api_key="<your API key>")
cs = deepsights.ContentStore(api_key="<your API key>")

Hello, world

To retrieve an answer from DeepSights:

import deepsights

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

# obtain answer
response = deepsights.answer_get(ds, "What are emerging food consumption moments for Gen Z?")

# returned data are pydantic objects
print(response.answer)

# 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.

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

deepsights-api-0.2.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

deepsights_api-0.2.0-py3-none-any.whl (47.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page