Skip to content

Commit

Permalink
Hotfix/docs v030 (#282)
Browse files Browse the repository at this point in the history
Co-authored-by: marcopeix <[email protected]>
  • Loading branch information
MMenchero and marcopeix committed Apr 23, 2024
1 parent ad5519b commit b2a0008
Show file tree
Hide file tree
Showing 18 changed files with 1,211 additions and 1,907 deletions.
427 changes: 11 additions & 416 deletions nbs/docs/getting-started/1_getting_started_short.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Setting Up Your Authentication Token "
"# Setting Up Your Authentication API Key"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A **token**, also known as an **API Key**, is a unique string of characters that serves as a key to authenticate your requests to `TimeGTP`. This tutorial will explain how to set up your token when using the Nixtla SDK. \n",
"An **API key** is a unique string of characters that serves as a key to authenticate your requests to `TimeGTP`. This tutorial will explain how to set up your API key when using the Nixtla SDK. \n",
"\n",
"Upon [registration](https://dashboard.nixtla.io/), you will recibe an email asking you to confirm your signup. After confirming, you will receive access to your dashboard. There, under `API Keys`, you will find your token. To integrate your token into your development workflow with the Nixtla SDK, you have two methods. "
"Upon [registration](https://dashboard.nixtla.io/), you will recibe an email asking you to confirm your signup. After confirming, you will receive access to your dashboard. There, under `API Keys`, you will find your API key. To integrate your API key into your development workflow with the Nixtla SDK, you have two methods. "
]
},
{
Expand All @@ -22,27 +22,18 @@
"source": [
"## 1. Direct copy and paste \n",
"\n",
"- **Step 1**: Copy the token found in the `API Keys` of your [dashboard]((https://dashboard.nixtla.io/)). \n",
"- **Step 2**: Instantiate the `NixtlaClient` class by directly pasting your token into the code, as shown below:"
"- **Step 1**: Copy the API key found in the `API Keys` of your [dashboard]((https://dashboard.nixtla.io/)). \n",
"- **Step 2**: Instantiate the `NixtlaClient` class by directly pasting your API key into the code, as shown below:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/ubuntu/projects/nixtla/nixtlats/nixtla_client.py:56: FutureWarning: `'token'` is deprecated; use `'api_key'` instead.\n",
" warnings.warn(\n"
]
}
],
"outputs": [],
"source": [
"from nixtlats import NixtlaClient \n",
"nixtla_client = NixtlaClient(token = 'your token here')"
"nixtla_client = NixtlaClient(api_key ='your API key here')"
]
},
{
Expand All @@ -63,26 +54,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"- **Step 1:** Store your token in an environment variable named `NIXTLA_API_KEY`. This can be done for a session or permanently, depending on your preference.\n",
"- **Step 1:** Store your API key in an environment variable named `NIXTLA_API_KEY`. This can be done for a session or permanently, depending on your preference.\n",
"- **Step 2:** When you instantiate the `NixtlaClient` class, the SDK will automatically look for the `NIXTLA_API_KEY` environment variable and use it to authenticate your requests."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"#| hide\n",
"from dotenv import load_dotenv\n",
Expand Down Expand Up @@ -123,7 +103,7 @@
"Use the `export` command to set `NIXTLA_API_KEY`. \n",
"\n",
"``` bash\n",
"export NIXTLA_API_KEY=your_token\n",
"export NIXTLA_API_KEY=your_api_key\n",
"```"
]
},
Expand All @@ -133,11 +113,11 @@
"source": [
"### b. Using a `.env` file\n",
"\n",
"For a more persistent solution that can be version-controlled if private, or for ease of use across different projects, place your token in a `.env` file.\n",
"For a more persistent solution that can be version-controlled if private, or for ease of use across different projects, place your API key in a `.env` file.\n",
"\n",
"``` bash\n",
"# Inside a file named .env\n",
"NIXTLA_API_KEY=your_token\n",
"NIXTLA_API_KEY=your_api_key\n",
"```"
]
},
Expand Down Expand Up @@ -165,50 +145,32 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This approach is more secure and suitable for applications that will be deployed or shared, as it keeps tokens out of the source code."
"This approach is more secure and suitable for applications that will be deployed or shared, as it keeps API keys out of the source code."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"::: {.callout-important}\n",
"Remember, your token is like a password - keep it secret, keep it safe!\n",
"Remember, your API key is like a password - keep it secret, keep it safe!\n",
"::: "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Validate your token\n",
"## Validate your API key\n",
"\n",
"You can always find your token in the `API Keys` section of your dashboard. To check the status of your token, use the `validate_api_key` method of the `Nixtla` class. This method will return `True` if the token is valid and `False` otherwise. "
"You can always find your API key in the `API Keys` section of your dashboard. To check the status of your API key, use the `validate_api_key` method of the `NixtlaClient` class. This method will return `True` if the API key is valid and `False` otherwise. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:nixtlats.nixtla_client:Happy Forecasting! :), If you have questions or need support, please email [email protected]\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"nixtla_client.validate_api_key()"
]
Expand All @@ -217,7 +179,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You don't need to validate your token every time you use `TimeGPT`. This function is provided for your convenience to ensure its validity. For full access to `TimeGPT`'s functionalities, in addition to a valid token, you also need sufficient credits in your account. You can check your credits in the `Usage` section of your [dashboard]((https://dashboard.nixtla.io/)). "
"You don't need to validate your API key every time you use `TimeGPT`. This function is provided for your convenience to ensure its validity. For full access to `TimeGPT`'s functionalities, in addition to a valid API key, you also need sufficient credits in your account. You can check your credits in the `Usage` section of your [dashboard]((https://dashboard.nixtla.io/)). "
]
}
],
Expand Down
18 changes: 9 additions & 9 deletions nbs/docs/how-to-guides/0_distributed_fcst_spark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"id": "c5b9207c-29d1-4034-8d2e-223abc831cf1",
"metadata": {},
"source": [
"Instantiate `TimeGPT` class."
"Instantiate `NixtlaClient` class."
]
},
{
Expand All @@ -102,7 +102,7 @@
"metadata": {},
"outputs": [],
"source": [
"from nixtlats import TimeGPT"
"from nixtlats import NixtlaClient"
]
},
{
Expand All @@ -112,9 +112,9 @@
"metadata": {},
"outputs": [],
"source": [
"timegpt = TimeGPT(\n",
" # defaults to os.environ.get(\"TIMEGPT_TOKEN\")\n",
" token = 'my_token_provided_by_nixtla'\n",
"nixtla_client = NixtlaClient(\n",
" # defaults to os.environ.get(\"NIXTLA_API_KEY\")\n",
" api_key = 'my_api_key_provided_by_nixtla'\n",
")"
]
},
Expand All @@ -126,7 +126,7 @@
"outputs": [],
"source": [
"#| hide\n",
"timegpt = TimeGPT()"
"nixtla_client = NixtlaClient()"
]
},
{
Expand Down Expand Up @@ -178,7 +178,7 @@
"metadata": {},
"outputs": [],
"source": [
"fcst_df = timegpt.forecast(spark_df, h=12)\n",
"fcst_df = nixtla_client.forecast(spark_df, h=12)\n",
"fcst_df.show(5)"
]
},
Expand All @@ -203,7 +203,7 @@
"#| hide\n",
"# test different results for different models\n",
"fcst_df_1 = fcst_df.toPandas()\n",
"fcst_df_2 = timegpt.forecast(spark_df, h=12, model='timegpt-1-long-horizon')\n",
"fcst_df_2 = nixtla_client.forecast(spark_df, h=12, model='timegpt-1-long-horizon')\n",
"fcst_df_2 = fcst_df_2.toPandas()\n",
"test_fail(\n",
" lambda: pd.testing.assert_frame_equal(fcst_df_1[['TimeGPT']], fcst_df_2[['TimeGPT']]),\n",
Expand Down Expand Up @@ -284,7 +284,7 @@
"metadata": {},
"outputs": [],
"source": [
"timegpt_fcst_ex_vars_df = timegpt.forecast(df=spark_df, X_df=spark_future_ex_vars_df, h=24, level=[80, 90])\n",
"timegpt_fcst_ex_vars_df = nixtla_client.forecast(df=spark_df, X_df=spark_future_ex_vars_df, h=24, level=[80, 90])\n",
"timegpt_fcst_ex_vars_df.show(5)"
]
},
Expand Down
16 changes: 8 additions & 8 deletions nbs/docs/how-to-guides/1_distributed_cv_spark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"id": "c5b9207c-29d1-4034-8d2e-223abc831cf1",
"metadata": {},
"source": [
"Instantiate `TimeGPT` class."
"Instantiate `NixtlaClient` class."
]
},
{
Expand All @@ -102,7 +102,7 @@
"metadata": {},
"outputs": [],
"source": [
"from nixtlats import TimeGPT"
"from nixtlats import NixtlaClient"
]
},
{
Expand All @@ -112,9 +112,9 @@
"metadata": {},
"outputs": [],
"source": [
"timegpt = TimeGPT(\n",
" # defaults to os.environ.get(\"TIMEGPT_TOKEN\")\n",
" token = 'my_token_provided_by_nixtla'\n",
"nixtla_client = NixtlaClient(\n",
" # defaults to os.environ.get(\"NIXTLA_API_KEY\")\n",
" api_key = 'my_api_key_provided_by_nixtla'\n",
")"
]
},
Expand All @@ -126,7 +126,7 @@
"outputs": [],
"source": [
"#| hide\n",
"timegpt = TimeGPT()"
"nixtla_client = NixtlaClient()"
]
},
{
Expand Down Expand Up @@ -178,7 +178,7 @@
"metadata": {},
"outputs": [],
"source": [
"fcst_df = timegpt.cross_validation(spark_df, h=12, n_windows=5, step_size=2)\n",
"fcst_df = nixtla_client.cross_validation(spark_df, h=12, n_windows=5, step_size=2)\n",
"fcst_df.show(5)"
]
},
Expand Down Expand Up @@ -234,7 +234,7 @@
"metadata": {},
"outputs": [],
"source": [
"timegpt_cv_ex_vars_df = timegpt.cross_validation(\n",
"timegpt_cv_ex_vars_df = nixtla_client.cross_validation(\n",
" df=spark_df,\n",
" h=48, \n",
" level=[80, 90],\n",
Expand Down
33 changes: 12 additions & 21 deletions nbs/docs/misc/0_faqs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"source": [
"## Table of contents\n",
"- [TimeGPT](#timegpt)\n",
"- [TimeGPT Token](#timegpt-token)\n",
"- [TimeGPT API Key](#timegpt-api-key)\n",
"- [Features and Capabilities](#features-and-capabilities)\n",
"- [Fine-tuning](#finetuning)\n",
"- [Pricing and Billing](#pricing-and-billing)\n",
Expand Down Expand Up @@ -57,35 +57,35 @@
"\n",
"- Via the `TimeGPT` API. For instructions on how to call the API using different languages, please refer to the [API documentation](https://docs.nixtla.io/reference/timegpt_timegpt_post)\n",
"\n",
"Both methods require you to have a [token](#timegpt-token), which is obtained upon registration and can be found in your dashboard under `API Keys`."
"Both methods require you to have a [API key](#timegpt-api-key), which is obtained upon registration and can be found in your dashboard under `API Keys`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## TimeGPT Token"
"## TimeGPT API Key"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### What is a token?\n",
"### What is an API key?\n",
"\n",
"A token, also known as an API Key, is a unique string of characters that serves as a key to authenticate your requests when using the Nixtla SDK. It ensures that the person making the requests is authorized to do so.\n",
"An API key is a unique string of characters that serves as a key to authenticate your requests when using the Nixtla SDK. It ensures that the person making the requests is authorized to do so.\n",
"\n",
"### Where can I get a token? \n",
"### Where can I get an API key? \n",
"\n",
"Upon registration, you will receive a token that can be found in your [dashboard](https://dashboard.nixtla.io/) under `API Keys`. Remember that your token is personal and should not be shared with anyone.\n",
"Upon registration, you will receive an API key that can be found in your [dashboard](https://dashboard.nixtla.io/) under `API Keys`. Remember that your API key is personal and should not be shared with anyone.\n",
"\n",
"### How do I use my token?\n",
"### How do I use my API key?\n",
"\n",
"To integrate your token into your development workflow, please refer to the tutorial on [Setting Up Your Authentication Token](https://docs.nixtla.io/docs/setting_up_your_authentication_token). \n",
"To integrate your API key into your development workflow, please refer to the tutorial on [Setting Up Your Authentication API Key](https://docs.nixtla.io/docs/setting_up_your_authentication_api_key). \n",
"\n",
"### How can I check the status of my token?\n",
"### How can I check the status of my API key?\n",
"\n",
"If you want to check the status of your token, you can use the [`validate_token` method](https://nixtlaverse.nixtla.io/nixtla/timegpt.html#timegpt-validate-token) of the `TimeGPT` class. "
"If you want to check the status of your API key, you can use the [`validate_api_key` method](https://nixtlaverse.nixtla.io/nixtla/timegpt.html#timegpt-validate-api-key) of the `NixtlaClient` class. "
]
},
{
Expand Down Expand Up @@ -216,15 +216,6 @@
"Billing is done within the first five days of each month. We have partnered with Stripe to handle all payment processing. You can view your invoices and payment history in your [dashboard](https://dashboard.nixtla.io/) under `Billing`. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"::: {.callout-warning}\n",
"Don't confuse the input, output, and finetune tokens with the TimeGPT token or API Key. The input, output, and finetune tokens are used to calculate your usage costs, while the TimeGPT token is used to authenticate your requests.\n",
"::: "
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -271,7 +262,7 @@
"ApiError: status_code: 401, body: {'data': None, 'message': 'Invalid API key', 'details': 'Key not found', 'code': 'A12', 'requestID': 'E7F2BBTB2P', 'support': 'If you have questions or need support, please email [email protected]'}\n",
"```\n",
"\n",
"**Solution:** This error occurs when your `TimeGPT` token is either invalid or has not been set up correctly. Please use the `validate_token` method to verify it or make sure it was copied correctly from the `API Keys` section of your [dashboard](https://dashboard.nixtla.io/)."
"**Solution:** This error occurs when your `TimeGPT` API key is either invalid or has not been set up correctly. Please use the `validate_api_key` method to verify it or make sure it was copied correctly from the `API Keys` section of your [dashboard](https://dashboard.nixtla.io/)."
]
},
{
Expand Down
Loading

0 comments on commit b2a0008

Please sign in to comment.