Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'model_dump' #1089

Open
YashMeh opened this issue Aug 11, 2024 · 2 comments
Open

AttributeError: 'NoneType' object has no attribute 'model_dump' #1089

YashMeh opened this issue Aug 11, 2024 · 2 comments

Comments

@YashMeh
Copy link

YashMeh commented Aug 11, 2024

I am new to phiData and have been trying to run this example with together embedder but I have tried many ways and facing this issue for load_text

AttributeError: 'NoneType' object has no attribute 'model_dump'

If someone has faced this issue please let me know how to fix it.

I have tried with the following python versions - 3.12 and 3.9 using venv for creating virtual environments.
OS - Linux

@YashMeh
Copy link
Author

YashMeh commented Aug 11, 2024

Full Stack Trace -

Traceback (most recent call last):
  File "/home/yashmeh/polSumm/test.py", line 17, in <module>
    pol.load_text("The sky is blue")
  File "/home/yashmeh/polSumm/lib/python3.9/site-packages/phi/knowledge/base.py", line 163, in load_text
    self.load_documents(documents=[Document(content=text)], upsert=upsert, skip_existing=skip_existing)
  File "/home/yashmeh/polSumm/lib/python3.9/site-packages/phi/knowledge/base.py", line 120, in load_documents
    self.vector_db.insert(documents=documents_to_load)
  File "/home/yashmeh/polSumm/lib/python3.9/site-packages/phi/vectordb/pgvector/pgvector2.py", line 157, in insert
    document.embed(embedder=self.embedder)
  File "/home/yashmeh/polSumm/lib/python3.9/site-packages/phi/document/base.py", line 28, in embed
    self.embedding, self.usage = _embedder.get_embedding_and_usage(self.content)
  File "/home/yashmeh/polSumm/lib/python3.9/site-packages/phi/embedder/openai.py", line 69, in get_embedding_and_usage
    return embedding, usage.model_dump()
AttributeError: 'NoneType' object has no attribute 'model_dump'

@ysolanky
Copy link
Contributor

Hello @YashMeh! The fix for this bug is in this PR: #1090. It will be merged with the next phidata release

Thanks for brining this to our attention :)

@YashMeh YashMeh closed this as completed Aug 25, 2024
@YashMeh YashMeh reopened this Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants