langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
88.56k stars 13.91k forks source link

DOC: Missing positional arguments in Wikidata Langchain documentation. Path: /v0.2/docs/integrations/tools/wikidata/ #23344

Open anuran-roy opened 1 week ago

anuran-roy commented 1 week ago

URL

https://python.langchain.com/v0.2/docs/integrations/tools/wikidata/

Checklist

Issue with current documentation:

The current documentation does not cover the positional arguments required by the WikidataAPIWrapper. It needs the arguments wikidata_mw and wikidata_rest.

Link to faulty documentation page: https://python.langchain.com/v0.2/docs/integrations/tools/wikidata/

Idea or request for content:

Please update the code with the required arguments, and please explain from where we can get it. If needed, I can work on it as well. Thanks!

dcsan commented 1 week ago

I tried with # type: ignore the query runs but fails after

also i think those docs are wrong that it's blah.run it should be .invoke as the main tool calling interface.

tho i still see run in master here: https://github.com/langchain-ai/langchain/blob/master/libs/community/langchain_community/utilities/wikidata.py

======================================================================
ERROR: test_wikidata (tools.report.wikidata_test.TestEkg.test_wikidata)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/tools/report/wikidata_test.py", line 21, in test_wikidata
    res = wikidata.invoke(input=query)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/.venv/lib/python3.12/site-packages/langchain_core/tools.py", line 260, in invoke
    return self.run(
           ^^^^^^^^^
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/.venv/lib/python3.12/site-packages/langchain_core/tools.py", line 452, in run
    raise e
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/.venv/lib/python3.12/site-packages/langchain_core/tools.py", line 409, in run
    context.run(
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/.venv/lib/python3.12/site-packages/langchain_community/tools/wikidata/tool.py", line 30, in _run
    return self.api_wrapper.run(query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/.venv/lib/python3.12/site-packages/langchain_community/utilities/wikidata.py", line 177, in run
    if doc := self._item_to_document(item):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dc/dev/proj/tealbook/projectx/tealbot/server/.venv/lib/python3.12/site-packages/langchain_community/utilities/wikidata.py", line 149, in _item_to_document
    doc_lines.append(f"{prop.label}: {', '.join(values)}")
                                      ^^^^^^^^^^^^^^^^^
TypeError: sequence item 0: expected str instance, FluentValue found

what a mess. every time i use langchain i regret it and just go back to the working underlying libs it's just easier.

if you're gonna add obfuscation wrappers, at least don't make broken wrappers AND broken docs.