GraphRAG:< Not supported between instances of 'NoneType' and 'int'
- 0. 错误信息
- 1. 解决方法
0. 错误信息
使用 GraphRAG 调用 vllm 的 openai api 时,报错:
Not supported between instances of 'NoneType' and 'int'
1. 解决方法
vi /root/miniconda3/envs/vllm2024/lib/python3.10/site-packages/graphrag/llm/openai/openai_chat_llm.py--- add args['n'] = 1async def _execute_llm(self, input: CompletionInput, **kwargs: Unpack[LLMInput]) -> CompletionOutput | None:args = get_completion_llm_args(kwargs.get("model_parameters"), self.configuration)args['n'] = 1history = kwargs.get("history") or []messages = [*history,{"role": "user", "content": input},]completion = await self.client.chat.completions.create(messages=messages, **args)return completion.choices[0].message.content
---
完结!