Skip to content

Runtime error due to failure to criticize ontology #19

@sashapustota

Description

@sashapustota

Hi there!

Im running into the following error when trying to parse a JSON file:

INFO:ontocast.agent.chunk_text:Chunking the text
INFO:ontocast.tool.chunk.chunker:chunk lengths: [753]
INFO:ontocast.agent.check_chunks:Chunks (rem): 1, chunks proc: 0. Setting up current chunk
INFO:ontocast.agent.check_chunks:Chunk available, setting status to FAILED and proceeding to SELECT_ONTOLOGY
INFO:ontocast.agent.select_ontology:Selecting ontology
INFO:ontocast.util:Starting to execute Text to Ontology
INFO:ontocast.agent.render_ontology_triples:Starting to render ontology triples
INFO:ontocast.agent.render_ontology_triples:Creating fresh ontology
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
WARNING:ontocast.onto:Ontology IRI 'http://localhost:8999/ont_ltpqo' does not match expected 'http://localhost:8999/ltpqo'
INFO:ontocast.agent.render_ontology_triples:Ontology addendum has 54 triples.
INFO:ontocast.util:For Text to Ontology: status is SUCCESS, proceeding to next node
INFO:ontocast.util:Starting to execute Criticise Ontology
INFO:ontocast.agent.criticise_ontology:Criticize ontology
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:ontocast.agent.criticise_ontology:Updating existing ontology: _void_ontology_name
ERROR:ontocast.cli.serve:Error processing document: 
ERROR:ontocast.cli.serve:Error type: <class 'RuntimeError'>
ERROR:ontocast.cli.serve:Error traceback:
Traceback (most recent call last):
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 607, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/work/ontocastjobs/ontocast/ontocast/stategraph/util.py", line 51, in wrapper
    state = func(state)
            ^^^^^^^^^^^
  File "/work/ontocastjobs/ontocast/ontocast/agent/criticise_ontology.py", line 90, in criticise_ontology
    om_tool.update_ontology(
  File "/work/ontocastjobs/ontocast/ontocast/tool/ontology_manager.py", line 43, in update_ontology
    current_idx = next(
                  ^^^^^
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/work/ontocastjobs/ontocast/ontocast/cli/serve.py", line 176, in process
    async for chunk in workflow.astream(
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 1477, in astream
    async for _ in runner.atick(
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 130, in atick
    await arun_with_retry(t, retry_policy, stream=self.use_astream)
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langgraph/pregel/retry.py", line 102, in arun_with_retry
    await task.proc.ainvoke(task.input, config)
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langgraph/utils/runnable.py", line 453, in ainvoke
    input = await asyncio.create_task(coro, context=context)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langgraph/utils/runnable.py", line 236, in ainvoke
    ret = await asyncio.create_task(coro, context=context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 616, in run_in_executor
    return await asyncio.get_running_loop().run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/ontocastjobs/ontocast/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 612, in wrapper
    raise RuntimeError from exc
RuntimeError

I have also tried disabling the ontology critique by adding SKIP_ONTOLOGY_DEVELOPMENT=true to my .env file, but that doesn't seem to help.

I am running the code from within the cloned repo, using the default uv run serve --ontology-directory ../data/ontologies --working-directory ../data and curl -X POST http://localhost:8999/process -F "file=@data/json/random.json"

Hope this is a right place to post such a problem. Thank you in advance.

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