"Above, we showed how you could use Feast, a popular open source and self-managed feature store, with LangChain. Our examples below will show a similar integration using Tecton. Tecton is a fully managed feature platform built to orchestrate the complete ML feature lifecycle, from transformation to online serving, with enterprise-grade SLAs."
]
},
{
"cell_type": "markdown",
"id": "7bb4dba1-0678-4ea4-be0a-d353c0b13fc2",
"metadata": {
"tags": []
},
"source": [
"### Prerequisites\n",
"\n",
"* Tecton Deployment (sign up at [https://tecton.ai](https://tecton.ai))\n",
"* `TECTON_API_KEY` environment variable set to a valid Service Account key"
]
},
{
"cell_type": "markdown",
"id": "ac9eb618-8c52-4cd6-bb8e-9c99a150dfa6",
"metadata": {
"tags": []
},
"source": [
"### Define and Load Features\n",
"\n",
"We will use the user_transaction_counts Feature View from the [Tecton tutorial](https://docs.tecton.ai/docs/tutorials/tecton-fundamentals) as part of a Feature Service. For simplicity, we are only using a single Feature View; however, more sophisticated applications may require more feature views to retrieve the features needed for its prompt.\n",
"\n",
"```python\n",
"user_transaction_metrics = FeatureService(\n",
" name = \"user_transaction_metrics\",\n",
" features = [user_transaction_counts]\n",
")\n",
"```\n",
"\n",
"The above Feature Service is expected to be [applied to a live workspace](https://docs.tecton.ai/docs/applying-feature-repository-changes-to-a-workspace). For this example, we will be using the \"prod\" workspace."
"Here we will set up a custom TectonPromptTemplate. This prompt template will take in a user_id , look up their stats, and format those stats into a prompt.\n",
"\n",
"Note that the input to this prompt template is just `user_id`, since that is the only user defined piece (all other variables are looked up inside the prompt template)."