Manu Chadha
Manu Chadha

Reputation: 16735

How to run a notebook in Azure for OpenAI project

I am following (or trying follow!) the steps in https://learn.microsoft.com/en-us/azure/cognitive-services/openai/tutorials/embeddings?tabs=powershell

I have created Azure Open AI (aoai) resource and deployed open ai models

Then I opened PowerShell in Azure and set the environment variables for key and endpoint for aoai. I downloaded the billsum.csv data file.

I am now stuck at where to run the notebook example - https://github.com/Azure-Samples/Azure-OpenAI-Docs-Samples/blob/main/Samples/Tutorials/Embeddings/embedding_billsum.ipynb

I created a synapse environment in the same resource group in which I have created aoai resources/models and tried to run the first cell of notebook in it. I got error

ModuleNotFoundError                       Traceback (most recent call last)
Cell In [5], line 1
----> 1 import openai
      2 import re
      3 import requests

Where do I execute the notebook code?

Upvotes: 0

Views: 1509

Answers (1)

Talha Tayyab
Talha Tayyab

Reputation: 27575

Before you run the jupyter cell you need to install the required libraries.

among these libraries:

import openai
import re
import requests
import sys
from num2words import num2words
import os
import pandas as pd
import numpy as np
from openai.embeddings_utils import get_embedding, cosine_similarity
from transformers import GPT2TokenizerFast

You need to explicitly install these in your jupyter cell.

!pip install openai   
!pip install num2words
!pip install scikit-learn  # this is for openai.embeddings_utils
!pip install transformers

Upvotes: 0

Related Questions