Skip to main content

Chat with Bigdata.com (Sunsetting)

We are sunsetting the Chat Service. It is still available in the SDK for backward compatibility, but it is recommended to use the Research Agent API which supports a lite research equivalent to the Chat version, and also a Deep Research capability.We are sunsetting the Chat Service. Although it is still available in the SDK for backward compatibility, we recommend using the Research Agent API, which supports a lite research equivalent to the Chat version, as well as a Deep Research capability.Check out the Research Agent Quickstart Guide.
In just 5 minutes, you’ll learn how to: ✅ Install bigdata-client package
✅ Authenticate to Bigdata.com
✅ Chat with Bigdata.com
✅ Delete the chat instance
Ready to get started? Let’s dive in! Open in Colab
Each question queries Bigdata.com and consumes API units - Monitor usage accordingly.

Install bigdata-client package

First of all, let’s install bigdata-client package in a python virtual environment. Open the terminal and create a virtual environment with the following command:
Activate the virtual environment, every time you want to use it:
And install the bigdata-client within the environment bigdata_venv.

Authenticate to bigdata.com

Enter the python interpreter with the following command
Now you can import the Bigdata object from the bigdata_client package,
And initiate it with your bigdata.com personal credentials.

Chat with bigdata.com

Your proprietary App or Server can leverage this programmatic research experience similar to the way you chat with the Bigdata Assistant App. Create a new Chat Let’s create a Chat instance:
Chat support formatter. This is the mechanism to customize inline attribution in chat answers. By default DefaultFormatter is used. For more information see Inline attribution formatter
First question We can ask a question and print both, the question and the answer:
Output:

Inline attribution

The response object contains an array of source references that the Chat Service used to ground the response into truth. Those inline attribution references have the format :ref[i] where i is the index in the list response.sources.
Output:

Source filtering

We can also receive chat responses grounded in data from a curated list of trusted sources. We can filter Bigdata’s indexed sources that you can identify using the Knowledge Graph find_sources method. The following example find sources by name, and it is also possible to find sources by Country and Rank, check out the page Find Sources for more details. It is not possible to filter web sources that Bigdata has not indexed. If you have other sources essential for your use case, please reach out to support@bigdata.com to consider adding them.
Output:
Now we can use that list of sources directly in the new parameter source_filter
All documents in the inline attribution are from the specified source.
Ask any follow up questions You can continue asking questions. It will remember your previous questions and answers within this chat instance.
Output:

Chat with bigdata.com in Streaming mode

Chat support streaming mode When streaming=True param provided to chat.ask method it returns StreamingChatInteraction instead of ChatInteraction StreamingChatInteraction implements iterator. Also it has same interface as ChatInteracion and contains exactly same properties. Ask question with streaming We can ask a question and print both, the question and the answer:
Output:
Unless iterator fully consumed, StreamingChatInteraction properties are not filled with data

Delete the chat instance

We can delete this chat instance if we no longer need to ask follow-up questions.

Summary

Congratulations! 🎉 You have successfully integrated with Bigdata.com chat service programmatically, and we can’t wait to see what you build. We’re always around to help.

Next steps

We recommend exploring the following pages: