PermissionDeniedError: Error code: 403 - {'error': {'message': 'You are not allowed to sample from this model'

Im trying to use an embedding model in colab (text-embedding-3-small, but it doesnt work with others either) I put 5 dollars in my account to use it and still sends this error, anyone know what could it be?

Welcome to the Community!

Hmm - are you using it correctly?

you typically get this error when you try to use an embedding model as a completion model (or the other way round?)

Hi! thanks for replying
I was following a tutorial so I think I a, here’s the code:
def response_query(db, query, k):
docs = db.similarity_search(query,k=k)
docs_page_content = " ".join([d.page_content for d in docs])

llm = OpenAI(model=“text-embedding-3-small”,

prompt = PromptTemplate(
template = “”"
You are a helpful assistant that that can answer questions about youtube videos
based on the video’s transcript.

    Answer the following question: {question}
    By searching the following video transcript: {docs}
    Only use the factual information from the transcript to answer the question.
    If you feel like you don't have enough information to answer the question, say "I don't know".
    Your answers should be verbose and detailed.


chain = LLMChain(llm=llm, prompt=prompt)

response =, docs=docs_page_content)
response = response.replace(“\n”,“”)
return response

the model the guy in the tutorial was using is text-davinci-003 but I think that one is no longer available

text davinci 003 is/was a completion model, although there was an embedding variant of that too.

you probably want completions instead :


unless the error came from

docs = db.similarity_search(query,k=k)

but then we’d need to see how that is set up.

oh my god it worked with the gpt-3.5-turbo-instruct thank you so much
I didnt know about the completion model I just started learning this stuff

again thank for the solution and for your quick reply

1 Like

Sure thing :cowboy_hat_face: