Find answers from the community

s
F
Y
a
P
Updated last month

I just run this example and it exceeded

I just run this example and it exceeded my quota? but the usage dashboard is not showing anything
T
H
5 comments
The usage dashboard takes a while to update, check that you have enough OpenAI credits or a valid payment method
I do. I am tier 4 customer
I can use the openai api just fine? I think this is related to llama_index
I resolved my problem. It was because of the organization id, I had multiple organizations under my account and llama_index was using the default which didn't have access to most of the models.
So anybody having similar problem try passing down your organization id:
Plain Text
from llama_index import VectorStoreIndex, SimpleDirectoryReader
from llama_index import ServiceContext
from llama_index.llms import OpenAI
from llama_index.embeddings import OpenAIEmbedding

import logging
import sys

logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))

embedding_model = OpenAIEmbedding(
    api_key="sk-XXXXXXXXXXXXXXXXXXXXXX",
    organization="org-XXXXXXXXXXXXXXXXXXXXXXXXX",
)


llm = OpenAI(
    api_key="sk-XXXXXXXXXXXXXXXXXXXXXXXXX",
    organization="org-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    model="gpt-4-1106-preview",
)

service_context = ServiceContext.from_defaults(llm=llm, embed_model=embedding_model)

def main():
    documents = SimpleDirectoryReader("data2").load_data(show_progress=True)
    index = VectorStoreIndex.from_documents(documents, show_progress=True, service_context=service_context)

    query_engine = index.as_query_engine(service_context=service_context)
    response = query_engine.query("What did the author do growing up?")
    print(response)

if __name__ == "__main__":
    main()
Add a reply
Sign up and join the conversation on Discord