2_azure_ai.ipynb 2.18 KB
Newer Older
bailuo's avatar
readme  
bailuo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# AzureAI \n",
    "\n",
    "> The foundational models for time series by Nixtla can be deployed on your Azure subscription. This page explains how to easily get started with TimeGEN-1 deployed as an Azure AI endpoint. If you use the `nixtla` library, it should be a drop-in replacement where you only need to change the client parameters (endpoint URL, API key, model name)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Deploying TimeGEN-1\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using the model\n",
    "\n",
    "Once your model is deployed and provided that you have the relevant permissions, consuming it will basically be the same process as for a Nixtla endpoint.\n",
    "\n",
    "To run the examples below, you will need to define the following environment variables:\n",
    "\n",
    "- `AZURE_AI_NIXTLA_BASE_URL` is your api URL, should be of the form `https://your-endpoint.inference.ai.azure.com/`.\n",
    "- `AZURE_AI_NIXTLA_API_KEY` is your authentication key."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How to use"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Just import the library, set your credentials, and start forecasting in two lines of code!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```bash\n",
    "pip install nixtla\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```python\n",
    "import os\n",
    "from nixtla import NixtlaClient\n",
    "\n",
    "base_url = os.environ[\"AZURE_AI_NIXTLA_BASE_URL\"]\n",
    "api_key = os.environ[\"AZURE_AI_NIXTLA_API_KEY\"]\n",
    "model = \"azureai\"\n",
    "\n",
    "nixtla_client = NixtlaClient(api_key=api_key, base_url=base_url)\n",
    "nixtla_client.forecast(\n",
    "    ...,\n",
    "    model=model,\n",
    ")\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "python3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}