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

TypeError: Object of type Tag is not JSON serializable #18

Open
richlysakowski opened this issue Jan 12, 2025 · 1 comment
Open

TypeError: Object of type Tag is not JSON serializable #18

richlysakowski opened this issue Jan 12, 2025 · 1 comment

Comments

@richlysakowski
Copy link

When loading URLs I get this error message. I tried just loading the ThinkRAG webpage.
I got this same error with other webpages.

I am running ThinkRAG locally on Windows 10 Pro, Ollama, Llama3 LLM.

I tried fixing the code after these two errors, but I have not fixed it yet. I will post and synch the solution if I can get it working on my local installation.
#########################################################
TypeError: Object of type Tag is not JSON serializable
Traceback:

File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 579, in code_to_exec
exec(code, module.dict)
File "C:\Users\PowerUser\Documents\Github_RSL_Utils\ThinkRAG\app.py", line 55, in
pg.run()
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\streamlit\navigation\page.py", line 303, in run
exec(code, module.dict)
File "C:\Users\PowerUser\Documents\Github_RSL_Utils\ThinkRAG\frontend\KB_Web.py", line 61, in
handle_website()
File "C:\Users\PowerUser\Documents\Github_RSL_Utils\ThinkRAG\frontend\KB_Web.py", line 55, in handle_website
st.session_state.index_manager.load_websites(st.session_state["websites"], chunk_size, chunk_overlap)
File "C:\Users\PowerUser\Documents\Github_RSL_Utils\ThinkRAG\server\index.py", line 96, in load_websites
nodes = pipeline.run(documents=documents)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PowerUser\Documents\Github_RSL_Utils\ThinkRAG\server\ingestion.py", line 52, in run
nodes = super().run(documents=documents)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\llama_index\core\instrumentation\dispatcher.py", line 311, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\llama_index\core\ingestion\pipeline.py", line 560, in run
self.vector_store.add(nodes_with_embeddings)
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\llama_index\core\vector_stores\simple.py", line 257, in add
metadata = node_to_metadata_dict(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\site-packages\llama_index\core\vector_stores\utils.py", line 53, in node_to_metadata_dict
metadata["node_content"] = json.dumps(node_dict)
^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\json_init
.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\json\encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\json\encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\ThinkRAG\Lib\json\encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '

@wzdavid
Copy link
Owner

wzdavid commented Jan 21, 2025

Have you resolved this issue on Windows?

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