UW-xDD / text2graph_llm

An experimental API endpoint to convert text to knowledge graph triplets.
MIT License
2 stars 1 forks source link

End to end integration #27

Closed JasonLo closed 5 months ago

JasonLo commented 5 months ago

What it does:

  1. User input query
  2. Retrever paragraphs from ask-xDD retriever
  3. Known enitty identification based on MacroStrat dictionary
  4. Generate dynamic prompt for relationship triplets extraction
  5. Merge all triplets in all paragraph into a GraphOutput Object
  6. Convert to TTL format with provanace (not ready)
JasonLo commented 5 months ago

Somewhat finished merging.

@ilmcconnell can you take a look at the TTL output and see it if is correct or not?

http://cosmos0002.chtc.wisc.edu:8510/

ilmcconnell commented 5 months ago

@JasonLo

querying that endpoint with 'iron mines' returns a correctly formatted .ttl result

if I query with "Waldron Shale Indiana Stratigraphy" I get this error:

AttributeError: 'NoneType' object has no attribute 'additional_values'
Traceback:

File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
File "/app/main.py", line 34, in <module>
    outputs = asyncio.run(outputs)
              ^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
File "/app/text2graph/llm.py", line 273, in llm_graph_from_search
    graph = await ask_llm(
            ^^^^^^^^^^^^^^
File "/app/text2graph/llm.py", line 256, in ask_llm
    return await post_process(
           ^^^^^^^^^^^^^^^^^^^
File "/app/text2graph/llm.py", line 195, in post_process
    triplet.object.provenance.additional_values[
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks like that object Provenenace was None instead.