Is your feature request related to a problem? Please describe.
The title is pretty clear on this point
Describe the solution you'd like
Turns out, the LLMChain.predict() function requires you to pass **kwargs, which mean you need to provide a key-value pair, not just the value. Pretty simple fix.
Also, networkx is needed for ConversationKGMemory
Additional context
Error:
* Debug mode: off
[31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://192.168.2.21:8080
[33mPress CTRL+C to quit[0m
127.0.0.1 - - [25/Feb/2024 22:32:27] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [25/Feb/2024 22:32:27] "GET /start_chat/1 HTTP/1.1" 200 -
127.0.0.1 - - [25/Feb/2024 22:32:29] "OPTIONS /converse/ HTTP/1.1" 200 -
127.0.0.1 - - [25/Feb/2024 22:32:29] "[35m[1mPOST /converse/ HTTP/1.1[0m" 500 -
Error on request:
Traceback (most recent call last):
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/werkzeug/serving.py", line 362, in run_wsgi
execute(self.server.app)
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/werkzeug/serving.py", line 323, in execute
application_iter = app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask/app.py", line 1488, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask/app.py", line 1466, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask_cors/extension.py", line 176, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask/app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask_cors/extension.py", line 176, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/app.py", line 60, in decorated_function
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/app.py", line 122, in converse
ai_text = ai_message(chat_id, message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/ai.py", line 53, in ai_message
).predict(human_message)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/chains/llm.py", line 293, in predict
return self(kwargs, callbacks=callbacks)[self.output_key]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain_core/_api/deprecation.py", line 145, in warning_emitting_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/chains/base.py", line 378, in __call__
return self.invoke(
^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/chains/base.py", line 133, in invoke
inputs = self.prep_inputs(input)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/chains/base.py", line 481, in prep_inputs
external_context = self.memory.load_memory_variables(inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/memory/kg.py", line 43, in load_memory_variables
entities = self._get_current_entities(inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/memory/kg.py", line 100, in _get_current_entities
prompt_input_key = self._get_prompt_input_key(inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/memory/kg.py", line 74, in _get_prompt_input_key
return get_prompt_input_key(inputs, self.memory_variables)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mustafa/Documents/mindscape/server/venv/lib/python3.12/site-packages/langchain/memory/utils.py", line 19, in get_prompt_input_key
raise ValueError(f"One input key expected got {prompt_input_keys}")
ValueError: One input key expected got []
Is your feature request related to a problem? Please describe. The title is pretty clear on this point
Describe the solution you'd like Turns out, the
LLMChain.predict()
function requires you to pass**kwargs
, which mean you need to provide a key-value pair, not just the value. Pretty simple fix.Also, networkx is needed for ConversationKGMemory
Additional context Error: