You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error NameError: name 'self' is not defined suggests there's a problem with how self is used in your code. In Python, self is used within class methods to refer to the instance of the class. If you're seeing this error, it likely means self is being used outside of a class method or in a context where it's not defined.
From the code snippet you shared, self is not explicitly used, which indicates the issue might be in another part of your code not shown here. It's important to ensure that self is only used within class instance methods.
Additionally, the instantiation of OllamaEmbeddings in your code does not show a misuse of self, but make sure the parameters you're passing (like model="ollama/nomic-embed-text:latest") match the expected parameters of the OllamaEmbeddings class. Specifically, if OllamaEmbeddings expects a base_url parameter, ensure you're providing it correctly.
If the problem persists, please provide more context or the specific part of the code where self is used, along with any additional error messages or tracebacks. This will help in diagnosing the issue more accurately.
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
What happened?
def get_embeddings():
settings = BrainSettings() # pyright: ignore reportPrivateUsage=none
if settings.ollama_api_base_url:
embeddings = OllamaEmbeddings(
model="ollama/nomic-embed-text:latest"
) # pyright: ignore reportPrivateUsage=none
else:
embeddings = OpenAIEmbeddings() # pyright: ignore reportPrivateUsage=none
return embeddings
I have set it as above, but the following error occurred:
Relevant log output
Twitter / LinkedIn details
No response
The text was updated successfully, but these errors were encountered: