litellm - 💡(How to fix) Fix [Bug]: The integration with RAGFlow isn't working

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

JSONDecodeError Traceback (most recent call last) 2263 except Exception as e: During handling of the above exception, another exception occurred: APIConnectionError Traceback (most recent call last) 1594 print_verbose(f"Error while checking max token limit: {str(e)}") 4500 except Exception as e: 4501 ## Map to OpenAI Exception

RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Hello, everyone, I've noticed that the integration with RAGFlow isn't working. For reference, I've taken an example directly from the documentation: https://docs.litellm.ai/docs/providers/ragflow

from litellm import completion import os

os.environ['RAGFLOW_API_KEY'] = "ragflow-iOArb3cN7a0OYmYUwn0tKEF8g5KZTPozuGbkLAtUi1E" os.environ['RAGFLOW_API_BASE'] = "http://localhost:9380" # or your hosted URL

response = completion( model=f"ragflow/chat/{chat_id}/qwen/qwen3.6-plus", messages=[{"role": "user", "content": "Сколько раз в день ела Каштанка?"}] ) print(response)


JSONDecodeError Traceback (most recent call last) File ~/dspyenv/lib/python3.12/site-packages/litellm/main.py:2270, in completion(model, messages, timeout, temperature, top_p, n, stream, stream_options, stop, max_completion_tokens, max_tokens, modalities, prediction, audio, presence_penalty, frequency_penalty, logit_bias, user, reasoning_effort, verbosity, response_format, seed, tools, tool_choice, logprobs, top_logprobs, parallel_tool_calls, web_search_options, deployment_id, extra_headers, safety_identifier, service_tier, functions, function_call, base_url, api_version, api_key, model_list, thinking, shared_session, enable_json_schema_validation, **kwargs) 2264 logging.post_call( 2265 input=messages, 2266 api_key=api_key, 2267 original_response=str(e), 2268 additional_args={"headers": headers}, 2269 ) -> 2270 raise e 2271 elif custom_llm_provider == "xai": 2272 ## COMPLETION CALL

File ~/dspyenv/lib/python3.12/site-packages/litellm/main.py:2244, in completion(model, messages, timeout, temperature, top_p, n, stream, stream_options, stop, max_completion_tokens, max_tokens, modalities, prediction, audio, presence_penalty, frequency_penalty, logit_bias, user, reasoning_effort, verbosity, response_format, seed, tools, tool_choice, logprobs, top_logprobs, parallel_tool_calls, web_search_options, deployment_id, extra_headers, safety_identifier, service_tier, functions, function_call, base_url, api_version, api_key, model_list, thinking, shared_session, enable_json_schema_validation, **kwargs) 2243 try: -> 2244 response = base_llm_http_handler.completion( 2245 model=model, 2246 messages=messages, 2247 headers=headers, 2248 model_response=model_response, 2249 api_key=api_key, 2250 api_base=api_base, 2251 acompletion=acompletion, 2252 logging_obj=logging, 2253 optional_params=optional_params, 2254 litellm_params=litellm_params, 2255 shared_session=shared_session, 2256 timeout=timeout, 2257 client=client, 2258 custom_llm_provider=custom_llm_provider, 2259 encoding=_get_encoding(), 2260 stream=stream, 2261 provider_config=provider_config, 2262 ) 2263 except Exception as e:

File ~/dspyenv/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py:600, in BaseLLMHTTPHandler.completion(self, model, messages, api_base, custom_llm_provider, model_response, encoding, logging_obj, optional_params, timeout, litellm_params, acompletion, stream, fake_stream, api_key, headers, client, provider_config, shared_session) 598 logging_obj=logging_obj, 599 ) --> 600 return provider_config.transform_response( 601 model=model,

File ~/dspyenv/lib/python3.12/site-packages/litellm/llms/openai/openai.py:291, in OpenAIConfig.transform_response(self, model, raw_response, model_response, logging_obj, request_data, messages, optional_params, litellm_params, encoding, api_key, json_mode) 287 logging_obj.model_call_details["response_headers"] = raw_response.headers 288 final_response_obj = cast( 289 ModelResponse, 290 convert_to_model_response_object( --> 291 response_object=raw_response.json(), 292 model_response_object=model_response, 293 hidden_params={"headers": raw_response.headers}, 294 _response_headers=dict(raw_response.headers), 295 ), 296 ) 298 return final_response_obj

File ~/dspyenv/lib/python3.12/site-packages/httpx/_models.py:832, in Response.json(self, **kwargs) 831 def json(self, **kwargs: typing.Any) -> typing.Any: --> 832 return jsonlib.loads(self.content, **kwargs)

File /usr/lib/python3.12/json/init.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 343 if (cls is None and object_hook is None and 344 parse_int is None and parse_float is None and 345 parse_constant is None and object_pairs_hook is None and not kw): --> 346 return _default_decoder.decode(s) 347 if cls is None:

File /usr/lib/python3.12/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 """Return the Python representation of s (a str instance 334 containing a JSON document). 335 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end()

File /usr/lib/python3.12/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

APIConnectionError Traceback (most recent call last) Cell In[7], line 7 3 4 os.environ['RAGFLOW_API_KEY'] = "ragflow-iOArb3cN7a0OYmYUwn0tKEF8g5KZTPozuGbkLAtUi1E" 5 os.environ['RAGFLOW_API_BASE'] = "http://localhost:9380" # or your hosted URL 6 ----> 7 response = completion( 8 model=f"ragflow/chat/{chat_id}/qwen/qwen3.6-plus", 9 messages=[{"role": "user", "content": "Сколько раз в день ела Каштанка?"}] 10 )

File ~/dspyenv/lib/python3.12/site-packages/litellm/utils.py:1775, in client.<locals>.wrapper(*args, **kwargs) 1771 if logging_obj: 1772 logging_obj.failure_handler( 1773 e, traceback_exception, start_time, end_time 1774 ) # DO NOT MAKE THREADED - router retry fallback relies on this! -> 1775 raise e

File ~/dspyenv/lib/python3.12/site-packages/litellm/utils.py:1596, in client.<locals>.wrapper(*args, **kwargs) 1594 print_verbose(f"Error while checking max token limit: {str(e)}") 1595 # MODEL CALL -> 1596 result = original_function(*args, **kwargs) 1597 end_time = datetime.datetime.now() 1598 if _is_streaming_request( 1599 kwargs=kwargs, 1600 call_type=call_type, 1601 ):

File ~/dspyenv/lib/python3.12/site-packages/litellm/main.py:4502, in completion(model, messages, timeout, temperature, top_p, n, stream, stream_options, stop, max_completion_tokens, max_tokens, modalities, prediction, audio, presence_penalty, frequency_penalty, logit_bias, user, reasoning_effort, verbosity, response_format, seed, tools, tool_choice, logprobs, top_logprobs, parallel_tool_calls, web_search_options, deployment_id, extra_headers, safety_identifier, service_tier, functions, function_call, base_url, api_version, api_key, model_list, thinking, shared_session, enable_json_schema_validation, **kwargs) 4499 return response 4500 except Exception as e: 4501 ## Map to OpenAI Exception -> 4502 raise exception_type( 4503 model=model, 4504 custom_llm_provider=custom_llm_provider, 4505 original_exception=e, 4506 completion_kwargs=args, 4507 extra_kwargs=kwargs, 4508 )

File ~/dspyenv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py:2471, in exception_type(model, original_exception, custom_llm_provider, completion_kwargs, extra_kwargs) 2469 if isinstance(e, error_type): 2470 setattr(e, "litellm_response_headers", litellm_response_headers) -> 2471 raise e # it's already mapped 2472 raised_exc = APIConnectionError( 2473 message="{}\n{}".format( 2474 original_exception, (...) 2478 model="", 2479 ) 2480 setattr(raised_exc, "litellm_response_headers", litellm_response_headers)

File ~/dspyenv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py:644, in exception_type(model, original_exception, custom_llm_provider, completion_kwargs, extra_kwargs) 633 raise APIError( 634 status_code=original_exception.status_code, 635 message=f"APIError: {exception_provider} - {message}", (...) 639 litellm_debug_info=extra_information, 640 ) 641 else: 642 # if no status code then it is an APIConnectionError: https://github.com/openai/openai-python#handling-errors 643 # exception_mapping_worked = True --> 644 raise APIConnectionError( 645 message=f"APIConnectionError: {exception_provider} - {message}", 646 llm_provider=custom_llm_provider, 647 model=model, 648 litellm_debug_info=extra_information, 649 request=httpx.Request( 650 method="POST", url="https://api.openai.com/v1/" 651 ), 652 ) 653 elif ( 654 custom_llm_provider == "anthropic" 655 or custom_llm_provider == "anthropic_text" 656 ): # one of the anthropics 657 if "prompt is too long" in error_str or "prompt: length" in error_str:

APIConnectionError: litellm.APIConnectionError: APIConnectionError: RagflowException - Expecting value: line 1 column 1 (char 0)

Steps to Reproduce

Relevant log output

What part of LiteLLM is this about?

No response

What LiteLLM version are you on ?

1.86.0

Twitter / LinkedIn details

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING