Upload Documents

Structured Datasets

Prerequisites

To get the most out of this guide, you'll need to go to the FinChat Partner Portal to:
  • Create an API Key.
  • Add your credentials for OpenAI or Azure.

1. Create Pinecone Database

Before you can index your data with FinChat, you'll need to create a database that we will use to store your data.

  • Create a Pinecone account.
  • Create a new project: give it a name, choose your cloud provider of choice, and the region your database will be hosted in.
  • To find your API key, open the Pinecone console and click API Keys. This view also displays the environment for your project.
  • Together we will decide how to size your database based on the size of your dataset and desired performance. We will also need to decide what metadata fields to index for filtering (e.g., ticker).
fetch('https://controller.YOUR_PROJECT_ENVIRONMENT.pinecone.io/databases', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'text/plain',
'Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
dimension: 1536,
metric: 'cosine',
replicas: 1,
name: 'YOUR_VECTOR_DATABASE_NAME',
pods: 1,
pod_type: 's1.x1',
metadata_config: {
indexed: 'YOUR_METADATA_FIELDS'
}
})
})
curl --request POST
--url 'https://controller.YOUR_PROJECT_ENVIRONMENT.pinecone.io/databases'
-H 'Content-Type: application/json'
-H 'Accept: text/plain'
-H 'Api-Key: YOUR_API_KEY'
-d '{
"dimension": 1536,
"metric": "cosine",
"replicas": 1,
"name": "YOUR_VECTOR_DATABASE_NAME",
"pods": 1,
"pod_type": "s1.x1",
"metadata_config": {
"indexed": "YOUR_METADATA_FIELDS"
}
}'

Once you have created your database, you can start indexing your data. Add your project environment, database URL, and API Key in the FinChat Partner Portal.

2. Choose your datasets

The next step is to decide what datasets you want to index. You can add datasets from the FinChat Partner Portal. For each dataset:

  1. Give it a unique and descriptive title.
  2. Decide if you want to display text, table, chart, or chart and table.
  3. If you want to display a chart and/or table, provide the POST or GET endpoint where the data can be fetched. This is where you can specify how you want the widget for this dataset to behave: what toggles should be enabled and what the default values and options should be.
{
"title": "Apple Inc. Revenue Breakdown",
"logo": "https://finchat.io/assets/logos/24937.png",
"chartType": "stackedBar",
"toggles": {
"dataLabels": false,
"decimalPlaces": false,
"currency": true,
"period": true,
"format": true,
"reverseDates": false,
"timeframe": true,
"showPercentageChange": false
},
"defaults": {
"dataLabels": false,
"decimalPlaces": 2,
"currency": "USD",
"period": "Annual",
"format": "M",
"reverseDates": false,
"timeframe": "MAX",
"showPercentageChange": false
},
"options": {
"decimalPlaces": [
0,
10
],
"currency": [
"USD"
],
"period": [
"Annual",
"Quarterly",
"LTM"
],
"format": [
"K",
"M",
"B"
],
"timeframe": [
{
"label": "3Y",
"value": "2021-01-11"
},
{
"label": "5Y",
"value": "2019-01-11"
},
{
"label": "10Y",
"value": "2014-01-11"
},
{
"label": "MAX",
"value": null
}
]
},
"datasets": [
{
"title": "iPhone Revenue",
"period": "Annual",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2022-09-24",
"y": 205489000000
},
{
"x": "2021-09-25",
"y": 191973000000
},
{
"x": "2020-09-26",
"y": 137781000000
},
{
"x": "2019-09-28",
"y": 142381000000
},
{
"x": "2018-09-29",
"y": 164888000000
},
{
"x": "2017-09-30",
"y": 139337000000
},
{
"x": "2016-09-24",
"y": 136700000000
},
{
"x": "2015-09-26",
"y": 155041000000
},
{
"x": "2014-09-27",
"y": 101991000000
},
{
"x": "2013-09-28",
"y": 91279000000
},
{
"x": "2012-09-29",
"y": 78692000000
}
]
},
{
"title": "Services Revenue",
"period": "Annual",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2022-09-24",
"y": 78129000000
},
{
"x": "2021-09-25",
"y": 68425000000
},
{
"x": "2020-09-26",
"y": 53768000000
},
{
"x": "2019-09-28",
"y": 46291000000
},
{
"x": "2018-09-29",
"y": 39748000000
},
{
"x": "2017-09-30",
"y": 32700000000
},
{
"x": "2016-09-24",
"y": 24348000000
},
{
"x": "2015-09-26",
"y": 19909000000
},
{
"x": "2014-09-27",
"y": 18063000000
},
{
"x": "2013-09-28",
"y": 16051000000
},
{
"x": "2012-09-29",
"y": 12890000000
}
]
},
{
"title": "Wearables, Home and Accessories Revenue",
"period": "Annual",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2022-09-24",
"y": 41241000000
},
{
"x": "2021-09-25",
"y": 38367000000
},
{
"x": "2020-09-26",
"y": 30620000000
},
{
"x": "2019-09-28",
"y": 24482000000
},
{
"x": "2018-09-29",
"y": 17381000000
},
{
"x": "2017-09-30",
"y": 12826000000
},
{
"x": "2016-09-24",
"y": 11132000000
},
{
"x": "2015-09-26",
"y": 10067000000
},
{
"x": "2014-09-27",
"y": 8379000000
},
{
"x": "2013-09-28",
"y": 10117000000
},
{
"x": "2012-09-29",
"y": 10760000000
}
]
},
{
"title": "Mac Revenue",
"period": "Annual",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2022-09-24",
"y": 40177000000
},
{
"x": "2021-09-25",
"y": 35190000000
},
{
"x": "2020-09-26",
"y": 28622000000
},
{
"x": "2019-09-28",
"y": 25740000000
},
{
"x": "2018-09-29",
"y": 25198000000
},
{
"x": "2017-09-30",
"y": 25569000000
},
{
"x": "2016-09-24",
"y": 22831000000
},
{
"x": "2015-09-26",
"y": 25471000000
},
{
"x": "2014-09-27",
"y": 24079000000
},
{
"x": "2013-09-28",
"y": 21483000000
},
{
"x": "2012-09-29",
"y": 23221000000
}
]
},
{
"title": "iPad Revenue",
"period": "Annual",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2022-09-24",
"y": 29292000000
},
{
"x": "2021-09-25",
"y": 31862000000
},
{
"x": "2020-09-26",
"y": 23724000000
},
{
"x": "2019-09-28",
"y": 21280000000
},
{
"x": "2018-09-29",
"y": 18380000000
},
{
"x": "2017-09-30",
"y": 18802000000
},
{
"x": "2016-09-24",
"y": 20628000000
},
{
"x": "2015-09-26",
"y": 23227000000
},
{
"x": "2014-09-27",
"y": 30283000000
},
{
"x": "2013-09-28",
"y": 31980000000
},
{
"x": "2012-09-29",
"y": 30945000000
}
]
},
{
"title": "iPhone Revenue",
"period": "Quarterly",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 39669000000
},
{
"x": "2023-03-31",
"y": 51334000000
},
{
"x": "2022-12-31",
"y": 65775000000
},
{
"x": "2022-09-24",
"y": 42626000000
},
{
"x": "2022-06-25",
"y": 40665000000
},
{
"x": "2022-03-26",
"y": 50570000000
},
{
"x": "2021-12-25",
"y": 71628000000
},
{
"x": "2021-09-25",
"y": 38868000000
},
{
"x": "2021-06-26",
"y": 39570000000
},
{
"x": "2021-03-27",
"y": 47938000000
},
{
"x": "2020-12-26",
"y": 65597000000
},
{
"x": "2020-09-26",
"y": 26444000000
},
{
"x": "2020-06-27",
"y": 26418000000
},
{
"x": "2020-03-28",
"y": 28962000000
},
{
"x": "2019-12-28",
"y": 55957000000
}
]
},
{
"title": "Services Revenue",
"period": "Quarterly",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 21213000000
},
{
"x": "2023-03-31",
"y": 20907000000
},
{
"x": "2022-12-31",
"y": 20766000000
},
{
"x": "2022-09-24",
"y": 19188000000
},
{
"x": "2022-06-25",
"y": 19604000000
},
{
"x": "2022-03-26",
"y": 19821000000
},
{
"x": "2021-12-25",
"y": 19516000000
},
{
"x": "2021-09-25",
"y": 18277000000
},
{
"x": "2021-06-26",
"y": 17486000000
},
{
"x": "2021-03-27",
"y": 16901000000
},
{
"x": "2020-12-26",
"y": 15761000000
},
{
"x": "2020-09-26",
"y": 14549000000
},
{
"x": "2020-06-27",
"y": 13156000000
},
{
"x": "2020-03-28",
"y": 13348000000
},
{
"x": "2019-12-28",
"y": 12715000000
}
]
},
{
"title": "Wearables, Home and Accessories Revenue",
"period": "Quarterly",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 8284000000
},
{
"x": "2023-03-31",
"y": 8757000000
},
{
"x": "2022-12-31",
"y": 13482000000
},
{
"x": "2022-09-24",
"y": 9650000000
},
{
"x": "2022-06-25",
"y": 8084000000
},
{
"x": "2022-03-26",
"y": 8806000000
},
{
"x": "2021-12-25",
"y": 14701000000
},
{
"x": "2021-09-25",
"y": 8785000000
},
{
"x": "2021-06-26",
"y": 8775000000
},
{
"x": "2021-03-27",
"y": 7836000000
},
{
"x": "2020-12-26",
"y": 12971000000
},
{
"x": "2020-09-26",
"y": 7876000000
},
{
"x": "2020-06-27",
"y": 6450000000
},
{
"x": "2020-03-28",
"y": 6284000000
},
{
"x": "2019-12-28",
"y": 10010000000
}
]
},
{
"title": "Mac Revenue",
"period": "Quarterly",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 6840000000
},
{
"x": "2023-03-31",
"y": 7168000000
},
{
"x": "2022-12-31",
"y": 7735000000
},
{
"x": "2022-09-24",
"y": 11508000000
},
{
"x": "2022-06-25",
"y": 7382000000
},
{
"x": "2022-03-26",
"y": 10435000000
},
{
"x": "2021-12-25",
"y": 10852000000
},
{
"x": "2021-09-25",
"y": 9178000000
},
{
"x": "2021-06-26",
"y": 8235000000
},
{
"x": "2021-03-27",
"y": 9102000000
},
{
"x": "2020-12-26",
"y": 8675000000
},
{
"x": "2020-09-26",
"y": 9032000000
},
{
"x": "2020-06-27",
"y": 7079000000
},
{
"x": "2020-03-28",
"y": 5351000000
},
{
"x": "2019-12-28",
"y": 7160000000
}
]
},
{
"title": "iPad Revenue",
"period": "Quarterly",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 5791000000
},
{
"x": "2023-03-31",
"y": 6670000000
},
{
"x": "2022-12-31",
"y": 9396000000
},
{
"x": "2022-09-24",
"y": 7174000000
},
{
"x": "2022-06-25",
"y": 7224000000
},
{
"x": "2022-03-26",
"y": 7646000000
},
{
"x": "2021-12-25",
"y": 7248000000
},
{
"x": "2021-09-25",
"y": 8252000000
},
{
"x": "2021-06-26",
"y": 7368000000
},
{
"x": "2021-03-27",
"y": 7807000000
},
{
"x": "2020-12-26",
"y": 8435000000
},
{
"x": "2020-09-26",
"y": 6797000000
},
{
"x": "2020-06-27",
"y": 6582000000
},
{
"x": "2020-03-28",
"y": 4368000000
},
{
"x": "2019-12-28",
"y": 5977000000
}
]
},
{
"title": "iPhone Revenue",
"period": "LTM",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 199404000000
},
{
"x": "2023-03-31",
"y": 200400000000
},
{
"x": "2022-12-31",
"y": 199636000000
},
{
"x": "2022-09-24",
"y": 205489000000
},
{
"x": "2022-06-25",
"y": 201731000000
},
{
"x": "2022-03-26",
"y": 200636000000
},
{
"x": "2021-12-25",
"y": 198004000000
},
{
"x": "2021-09-25",
"y": 191973000000
},
{
"x": "2021-06-26",
"y": 179549000000
},
{
"x": "2021-03-27",
"y": 166397000000
},
{
"x": "2020-12-26",
"y": 147421000000
},
{
"x": "2020-09-26",
"y": 137781000000
}
]
},
{
"title": "Services Revenue",
"period": "LTM",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 82074000000
},
{
"x": "2023-03-31",
"y": 80465000000
},
{
"x": "2022-12-31",
"y": 79379000000
},
{
"x": "2022-09-24",
"y": 78129000000
},
{
"x": "2022-06-25",
"y": 77218000000
},
{
"x": "2022-03-26",
"y": 75100000000
},
{
"x": "2021-12-25",
"y": 72180000000
},
{
"x": "2021-09-25",
"y": 68425000000
},
{
"x": "2021-06-26",
"y": 64697000000
},
{
"x": "2021-03-27",
"y": 60367000000
},
{
"x": "2020-12-26",
"y": 56814000000
},
{
"x": "2020-09-26",
"y": 53768000000
}
]
},
{
"title": "Wearables, Home and Accessories Revenue",
"period": "LTM",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 40173000000
},
{
"x": "2023-03-31",
"y": 39973000000
},
{
"x": "2022-12-31",
"y": 40022000000
},
{
"x": "2022-09-24",
"y": 41241000000
},
{
"x": "2022-06-25",
"y": 40376000000
},
{
"x": "2022-03-26",
"y": 41067000000
},
{
"x": "2021-12-25",
"y": 40097000000
},
{
"x": "2021-09-25",
"y": 38367000000
},
{
"x": "2021-06-26",
"y": 37458000000
},
{
"x": "2021-03-27",
"y": 35133000000
},
{
"x": "2020-12-26",
"y": 33581000000
},
{
"x": "2020-09-26",
"y": 30620000000
}
]
},
{
"title": "Mac Revenue",
"period": "LTM",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 33251000000
},
{
"x": "2023-03-31",
"y": 33793000000
},
{
"x": "2022-12-31",
"y": 37060000000
},
{
"x": "2022-09-24",
"y": 40177000000
},
{
"x": "2022-06-25",
"y": 37847000000
},
{
"x": "2022-03-26",
"y": 38700000000
},
{
"x": "2021-12-25",
"y": 37367000000
},
{
"x": "2021-09-25",
"y": 35190000000
},
{
"x": "2021-06-26",
"y": 35044000000
},
{
"x": "2021-03-27",
"y": 33888000000
},
{
"x": "2020-12-26",
"y": 30137000000
},
{
"x": "2020-09-26",
"y": 28622000000
}
]
},
{
"title": "iPad Revenue",
"period": "LTM",
"format": "number",
"currency": "USD",
"isCurrency": true,
"table": false,
"chart": true,
"chartType": "bar",
"data": [
{
"x": "2023-07-01",
"y": 29031000000
},
{
"x": "2023-03-31",
"y": 30464000000
},
{
"x": "2022-12-31",
"y": 31440000000
},
{
"x": "2022-09-24",
"y": 29292000000
},
{
"x": "2022-06-25",
"y": 30370000000
},
{
"x": "2022-03-26",
"y": 30514000000
},
{
"x": "2021-12-25",
"y": 30675000000
},
{
"x": "2021-09-25",
"y": 31862000000
},
{
"x": "2021-06-26",
"y": 30407000000
},
{
"x": "2021-03-27",
"y": 29621000000
},
{
"x": "2020-12-26",
"y": 26182000000
},
{
"x": "2020-09-26",
"y": 23724000000
}
]
}
]
}
Apple Inc. Revenue Breakdown Website

Apple Inc. Revenue Breakdown

3. Index your datasets

After you've successfully added your dataset in the Partner Portal, the next step is to index it. This is done by sending a POST request that includes several key pieces of information:

  • Title: A clear and descriptive title for your dataset.
  • Description: A brief explanation of what the dataset contains. You have the option to use a description from our API or to write your own.
  • Companies: Specify the companies that are relevant to this dataset. This helps in associating the dataset with the right entities in our system.
  • Metadata: The guidelines here are dependent on the dataset which you use. Metadata should contain the details necessary for fetching the data from your endpoint or for applying filters. For instance, if your dataset includes articles, you might want to include the publication date in the metadata. This allows you to leverage the recency of articles, giving newer articles a higher priority in search results, or to remove outdated articles to maintain relevance.
const body = {
"datasets": [
{
"title": "PE Ratio",
"datasetType": "Valuation Ratios",
"id": "PE Ratio",
"description": "The PE Ratio, or Price-to-Earnings Ratio, is a key financial metric used to evaluate the valuation of a company's stock. It's calculated by dividing the current market price of a share by its earnings per share (EPS). This ratio provides insight into what investors are willing to pay for each dollar of a company's earnings. In essence, a high PE Ratio could indicate overvaluation or high growth expectations, while a low PE Ratio might suggest undervaluation or lower growth prospects.",
"metadata": {
"ratio": "P/E"
},
"companies": [
{
"name": "Apple Inc.",
"ticker": "AAPL",
"companyId": "NasdaqGS-AAPL"
},
{
"name": "Microsoft Corporation",
"ticker": "MSFT",
"companyId": "NasdaqGS-MSFT"
},
{
"name": "Alphabet Inc.",
"ticker": "GOOGL",
"companyId": "NasdaqGS-GOOGL"
},
{
"name": "Amazon.com, Inc.",
"ticker": "AMZN",
"companyId": "NasdaqGS-AMZN"
},
{
"name": "NVIDIA Corporation",
"ticker": "NVDA",
"companyId": "NasdaqGS-NVDA"
},
{
"name": "Meta Platforms, Inc.",
"ticker": "META",
"companyId": "NasdaqGS-META"
},
{
"name": "Berkshire Hathaway Inc.",
"ticker": "BRK.A",
"companyId": "NYSE-BRK.A"
},
{
"name": "Tesla, Inc.",
"ticker": "TSLA",
"companyId": "NasdaqGS-TSLA"
},
{
"name": "Visa Inc.",
"ticker": "V",
"companyId": "NYSE-V"
},
{
"name": "Eli Lilly and Company",
"ticker": "LLY",
"companyId": "NYSE-LLY"
}
]
}
]
}
await fetch("https://api.finchat.io/enterprise/documents}", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
Authorization: Bearer undefined
})
curl --request POST
--url https://api.finchat.io/enterprise/documents/
--header 'Content-Type: application/json'
--header 'Authorization: Bearer YOUR_API_KEY'
--data '{
"datasets": [
{
"title": "PE Ratio",
"datasetType": "Valuation Ratios",
"id": "PE Ratio",
"description": "The PE Ratio, or Price-to-Earnings Ratio, is a key financial metric used to evaluate the valuation of a company's stock. It's calculated by dividing the current market price of a share by its earnings per share (EPS). This ratio provides insight into what investors are willing to pay for each dollar of a company's earnings. In essence, a high PE Ratio could indicate overvaluation or high growth expectations, while a low PE Ratio might suggest undervaluation or lower growth prospects.",
"metadata": {
"ratio": "P/E"
},
"companies": [
{
"name": "Apple Inc.",
"ticker": "AAPL",
"companyId": "NasdaqGS-AAPL"
},
{
"name": "Microsoft Corporation",
"ticker": "MSFT",
"companyId": "NasdaqGS-MSFT"
},
{
"name": "Alphabet Inc.",
"ticker": "GOOGL",
"companyId": "NasdaqGS-GOOGL"
},
{
"name": "Amazon.com, Inc.",
"ticker": "AMZN",
"companyId": "NasdaqGS-AMZN"
},
{
"name": "NVIDIA Corporation",
"ticker": "NVDA",
"companyId": "NasdaqGS-NVDA"
},
{
"name": "Meta Platforms, Inc.",
"ticker": "META",
"companyId": "NasdaqGS-META"
},
{
"name": "Berkshire Hathaway Inc.",
"ticker": "BRK.A",
"companyId": "NYSE-BRK.A"
},
{
"name": "Tesla, Inc.",
"ticker": "TSLA",
"companyId": "NasdaqGS-TSLA"
},
{
"name": "Visa Inc.",
"ticker": "V",
"companyId": "NYSE-V"
},
{
"name": "Eli Lilly and Company",
"ticker": "LLY",
"companyId": "NYSE-LLY"
}
]
}
]
}'