Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'coroutine' object has no attribute 'choices' #393

Open
1042280163 opened this issue Jul 6, 2024 · 2 comments
Open

AttributeError: 'coroutine' object has no attribute 'choices' #393

1042280163 opened this issue Jul 6, 2024 · 2 comments

Comments

@1042280163
Copy link

1042280163 commented Jul 6, 2024

Traceback (most recent call last):
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\index\graph\extractors\graph\graph_extractor.py", line 118, in __call__
    result = await self._process_document(text, prompt_variables)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\index\graph\extractors\graph\graph_extractor.py", line 146, in _process_document
    response = await self._llm(
               ^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\openai\openai_token_replacing_llm.py", line 37, in __call__
    return await self._delegate(input, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\caching_llm.py", line 104, in __call__
    result = await self._delegate(input, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\rate_limiting_llm.py", line 177, in __call__
    result, start = await execute_with_retry()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\rate_limiting_llm.py", line 159, in execute_with_retry
    async for attempt in retryer:
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\tenacity\asyncio\__init__.py", line 166, in __anext__
    do = await self.iter(retry_state=self._retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\tenacity\asyncio\__init__.py", line 153, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\tenacity\_utils.py", line 99, in inner
    return call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\tenacity\__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "D:\Program Files\Python\Python311\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "D:\Program Files\Python\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\rate_limiting_llm.py", line 165, in execute_with_retry
    return await do_attempt(), start
           ^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\rate_limiting_llm.py", line 147, in do_attempt
    return await self._delegate(input, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\base_llm.py", line 49, in __call__
    return await self._invoke(input, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\base\base_llm.py", line 53, in _invoke
    output = await self._execute_llm(input, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\llm\openai\openai_completion_llm.py", line 43, in _execute_llm
    return completion.choices[0].text
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'choices'`


`15:44:07,345 datashaper.workflow.workflow ERROR Error executing verb "cluster_graph" in create_base_entity_graph: Columns must be same length as key
Traceback (most recent call last):
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\datashaper\workflow\workflow.py", line 410, in _execute_verb
    result = node.verb.func(**verb_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\index\verbs\graph\clustering\cluster_graph.py", line 102, in cluster_graph
    output_df[[level_to, to]] = pd.DataFrame(
    ~~~~~~~~~^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\pandas\core\frame.py", line 4299, in __setitem__
    self._setitem_array(key, value)
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\pandas\core\frame.py", line 4341, in _setitem_array
    check_key_length(self.columns, key, value)
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\pandas\core\indexers\utils.py", line 390, in check_key_length
    raise ValueError("Columns must be same length as key")
ValueError: Columns must be same length as key
15:44:07,427 graphrag.index.reporting.file_workflow_callbacks INFO Error executing verb "cluster_graph" in create_base_entity_graph: Columns must be same length as key details=None
15:44:07,427 graphrag.index.run ERROR error running workflow create_base_entity_graph
Traceback (most recent call last):
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\index\run.py", line 323, in run_pipeline
    result = await workflow.run(context, callbacks)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\datashaper\workflow\workflow.py", line 369, in run
    timing = await self._execute_verb(node, context, callbacks)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\datashaper\workflow\workflow.py", line 410, in _execute_verb
    result = node.verb.func(**verb_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\graphrag\index\verbs\graph\clustering\cluster_graph.py", line 102, in cluster_graph
    output_df[[level_to, to]] = pd.DataFrame(
    ~~~~~~~~~^^^^^^^^^^^^^^^^
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\pandas\core\frame.py", line 4299, in __setitem__
    self._setitem_array(key, value)
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\pandas\core\frame.py", line 4341, in _setitem_array
    check_key_length(self.columns, key, value)
  File "E:\Pycharm_Workspace\PythonProject\graphrag_test\venvs\Lib\site-packages\pandas\core\indexers\utils.py", line 390, in check_key_length
    raise ValueError("Columns must be same length as key")
ValueError: Columns must be same length as key
15:44:07,432 graphrag.index.reporting.file_workflow_callbacks INFO Error running pipeline! details=None```

Where is the problem?
@AlonsoGuevara
Copy link
Contributor

Hi!
Can you please share steps to reproduce? It is likely a missing await, given the error.

@jgbradley1
Copy link
Contributor

If you're okay with sharing, please post the config file that you are using so we can understand your initial setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants