Based on the provided code and the information available in the extracts, it's not possible to perform a comprehensive check for errors or bugs. However, the error message you provided gives some insight:
import openai
from langchain_openai import OpenAI
from llama_index.embeddings import OpenAIEmbedding
from llama_index import ServiceContext
llm = OpenAI()
embed_model = OpenAIEmbedding(
model="text-embedding-3-large",
dimensions=512,
)
service_context = ServiceContext.from_defaults(embed_model=embed_model, llm=OpenAI())
The error message "text-embedding-3-large’ is not a valid OpenAIEmbeddingModelType" suggests that the model name 'text-embedding-3-large' is not recognized. This could be due to several reasons:
-
The model name is misspelled or does not exist. Make sure that the model name is spelled correctly and that the model is available in the version of the OpenAI API you are using.
-
The libraries langchain_openai and llama_index might not support this model. You should check the documentation or source code of these libraries to see if 'text-embedding-3-large' is a supported model.
-
There might be a version mismatch between the OpenAI API and the libraries you are using. Make sure that all libraries and the API are up-to-date.
Unfortunately, without more information or access to the relevant documentation or source code, it's not possible to provide a more specific solution.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: