I keep getting a “ModuleNotFoundError: No module named ‘openai.embeddings.utils’” when I run this simple piece of code. I cannot figure out why and I’m sure it is something simple I’m missing.


from openai.embeddings_utils import get_embedding
import openai

def completion(prompt):
openai.api_key = ‘key’
response = get_embedding(prompt, engine=“text-search-davinci-query-001”)
return response

def lambda_handler(event, context):
response = completion(event[‘prompt’]).choices[0].text
print('Returning Response: ’ + response)
return {
‘statusCode’: 200,
‘body’: response

Hi, I run into the same issue. Did you solved it?

Hi, I didn’t get that particular issue resolved back a year ago. However, recently we did get embeddings to work using pinecone and gpt_index.

It doesn’t install all the dependencies with “pip install openai”
You need to use pip install openai[embeddings] to install them all at once.
openai · PyPI check this

1 Like