Skip to content

Ollama example needed, please~ ☕️ #241

Open
@adamwuyu

Description

@adamwuyu

I really like the flexibility and high integration of this project, so I have been trying to integrate with ollama today. Now it is 00:30 here and I have not succeeded yet. Can you help me?

Question 1:
This error will appear several times during the parsing process:

LLM response has improper format {'nodes': [{'name': 'Configuring the Prompt', 'type': 'document_section', 'content': '
...
chunk_index=2

If this error occurs, the corresponding chunk nodes and relationships will not be generated, right?

Question 2:
Why does parsing a little more content result in a 500 error, such as a 50-page PDF?

Question 3:
Why sometimes this error happens:

  File "/Users/adam/miniconda3/envs/lightrag/lib/python3.11/site-packages/neo4j/_sync/io/_common.py", line 254, in on_failure
    raise self._hydrate_error(metadata)
neo4j.exceptions.CypherTypeError: {code: Neo.ClientError.Statement.TypeError} {message: Property values can only be of primitive types or arrays thereof. Encountered: Map{title -> String("${movieTitle}"), score -> String("${score}")}.}
run_id='7ec2d19e-4c70-47c8-93d9-5b978228c242' result={'resolver': {'number_of_nodes_to_resolve': 0, 'number_of_created_nodes': None}}

Question 4:
In the latest version, the best practice for using the local ollama model is to use

from neo4j_graphrag.embeddings import OpenAIEmbeddings
from neo4j_graphrag.llm.openai_llm import OpenAILLM

or:

from neo4j_graphrag.embeddings.ollama import OllamaEmbeddings
from neo4j_graphrag.llm.ollama_llm import OllamaLLM

Using the former can start parsing, but it will cause problems 1, 2 and 3 mentioned above; if the latter is used, parsing cannot be started, and an error is prompted:

File "/Users/adam/miniconda3/envs/lightrag/lib/python3.11/site-packages/pydantic/main.py", line 214, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic_core._pydantic_core.ValidationError: 1 validation error for Neo4jNode embedding_properties.embedding.0 Input should be a valid number [type=float_type, input_value=[0.0035258962, 0.00050194...047494516, -0.006978964], input_type=list] For further information visit https://errors.pydantic.dev/2.10/v/float_type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions