cloudflare / cloudflare/cloudflared
🐛PermissionDeniedError: Cloudflare Blocking API Access
- Dominant language
- Go
- Stars
- 15.6k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
* https://github.com/run-llama/llama_index/issues/16796
I then moved on to investigating the Groq API and ran the code from the [documentation](https://docs.llamaindex.ai/en/stable/examples/llm/groq/). You can see the error and the code that led to it in this [notebook](https://github.com/hherpa/LlamaIndex-Reliability-Issues/blob/main/PermissionDeniedError.ipynb).
**Steps to Reproduce**
[notebook](https://github.com/hherpa/LlamaIndex-Reliability-Issues/blob/main/PermissionDeniedError.ipynb)
os: win11
**Relevant Logs/Tracbacks**
```shell
-----------------------------------------------------------
PermissionDeniedError Traceback (most recent call last)
Cell In[21], line 1
----> 1 response = llm.complete("Explain the importance of low latency LLMs")
2 print(response)
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\core\instrumentation\dispatcher.py:311, in Dispatcher.span..wrapper(func, instance, args, kwargs)
308 _logger.debug(f"Failed to reset active_span_id: {e}")
310 try:
--> 311 result = func(*args, **kwargs)
312 if isinstance(result, asyncio.Future):
313 # If the result is a Future, wrap it
314 new_future = asyncio.ensure_future(result)
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\llms\openai_like\base.py:99, in OpenAILike.complete(self, prompt, formatted, **kwargs)
96 if not formatted:
97 prompt = self.completion_to_prompt(prompt)
---> 99 return super().complete(prompt, **kwargs)
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\core\instrumentation\dispatcher.py:311, in Dispatcher.span..wrapper(func, instance, args, kwargs)
308 _logger.debug(f"Failed to reset active_span_id: {e}")
310 try:
--> 311 result = func(*args, **kwargs)
312 if isinstance(result, asyncio.Future):
313 # If the result is a Future, wrap it
314 new_future = asyncio.ensure_future(result)
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\core\llms\callbacks.py:431, in llm_completion_callback..wrap..wrapped_llm_predict(_self, *args, **kwargs)
422 event_id = callback_manager.on_event_start(
423 CBEventType.LLM,
424 payload={
(...)
428 },
429 )
430 try:
--> 431 f_return_val = f(_self, *args, **kwargs)
432 except BaseException as e:
433 callback_manager.on_event_end(
434 CBEventType.LLM,
435 payload={EventPayload.EXCEPTION: e},
436 event_id=event_id,
437 )
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\llms\openai\base.py:375, in OpenAI.complete(self, prompt, formatted, **kwargs)
373 else:
374 complete_fn = self._complete
--> 375 return complete_fn(prompt, **kwargs)
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\core\base\llms\generic_utils.py:173, in chat_to_completion_decorator..wrapper(prompt, **kwargs)
170 def wrapper(prompt: str, **kwargs: Any) -> CompletionResponse:
171 # normalize input
172 messages = prompt_to_messages(prompt)
--> 173 chat_response = func(messages, **kwargs)
174 # normalize output
175 return chat_response_to_completion_response(chat_response)
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\llms\openai\base.py:106, in llm_retry_decorator..wrapper(self, *args, **kwargs)
97 return f(self, *args, **kwargs)
99 retry = create_retry_decorator(
100 max_retries=max_retries,
101 random_exponential=True,
(...)
104 max_seconds=20,
105 )
--> 106 return retry(f)(self, *args, **kwargs)
File ~\AppData\Roaming\Python\Python311\site-packages\tenacity\__init__.py:289, in BaseRetrying.wraps..wrapped_f(*args, **kw)
287 @functools.wraps(f)
288 def wrapped_f(*args: t.Any, **kw: t.Any) -> t.Any:
--> 289 return self(f, *args, **kw)
File ~\AppData\Roaming\Python\Python311\site-packages\tenacity\__init__.py:379, in Retrying.__call__(self, fn, *args, **kwargs)
377 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs)
378 while True:
--> 379 do = self.iter(retry_state=retry_state)
380 if isinstance(do, DoAttempt):
381 try:
File ~\AppData\Roaming\Python\Python311\site-packages\tenacity\__init__.py:314, in BaseRetrying.iter(self, retry_state)
312 is_explicit_retry = fut.failed and isinstance(fut.exception(), TryAgain)
313 if not (is_explicit_retry or self.retry(retry_state)):
--> 314 return fut.result()
316 if self.after is not None:
317 self.after(retry_state)
File C:\Program Files\Python311\Lib\concurrent\futures\_base.py:449, in Future.result(self, timeout)
447 raise CancelledError()
448 elif self._state == FINISHED:
--> 449 return self.__get_result()
451 self._condition.wait(timeout)
453 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File C:\Program Files\Python311\Lib\concurrent\futures\_base.py:401, in Future.__get_result(self)
399 if self._exception:
400 try:
--> 401 raise self._exception
402 finally:
403 # Break a reference cycle with the exception in self._exception
404 self = None
File ~\AppData\Roaming\Python\Python311\site-packages\tenacity\__init__.py:382, in Retrying.__call__(self, fn, *args, **kwargs)
380 if isinstance(do, DoAttempt):
381 try:
--> 382 result = fn(*args, **kwargs)
383 except BaseException: # noqa: B902
384 retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type]
File ~\AppData\Roaming\Python\Python311\site-packages\llama_index\llms\openai\base.py:429, in OpenAI._chat(self, messages, **kwargs)
426 message_dicts = to_openai_message_dicts(messages, model=self.model)
428 if self.reuse_client:
--> 429 response = client.chat.completions.create(
430 messages=message_dicts,
431 stream=False,
432 **self._get_model_kwargs(**kwargs),
433 )
434 else:
435 with client:
File ~\AppData\Roaming\Python\Python311\site-packages\openai\_utils\_utils.py:274, in required_args..inner..wrapper(*args, **kwargs)
272 msg = f"Missing required argument: {quote(missing[0])}"
273 raise TypeError(msg)
--> 274 return func(*args, **kwargs)
File ~\AppData\Roaming\Python\Python311\site-packages\openai\resources\chat\completions.py:815, in Completions.create(self, messages, model, audio, frequency_penalty, function_call, functions, logit_bias, logprobs, max_completion_tokens, max_tokens, metadata, modalities, n, parallel_tool_calls, presence_penalty, response_format, seed, service_tier, stop, store, stream, stream_options, temperature, tool_choice, tools, top_logprobs, top_p, user, extra_headers, extra_query, extra_body, timeout)
775 @required_args(["messages", "model"], ["messages", "model", "stream"])
776 def create(
777 self,
(...)
812 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
813 ) -> ChatCompletion | Stream[ChatCompletionChunk]:
814 validate_response_format(response_format)
--> 815 return self._post(
816 "/chat/completions",
817 body=maybe_transform(
818 {
819 "messages": messages,
820 "model": model,
821 "audio": audio,
822 "frequency_penalty": frequency_penalty,
823 "function_call": function_call,
824 "functions": functions,
825 "logit_bias": logit_bias,
826 "logprobs": logprobs,
827 "max_completion_tokens": max_completion_tokens,
828 "max_tokens": max_tokens,
829 "metadata": metadata,
830 "modalities": modalities,
831 "n": n,
832 "parallel_tool_calls": parallel_tool_calls,
833 "presence_penalty": presence_penalty,
834 "response_format": response_format,
835 "seed": seed,
836 "service_tier": service_tier,
837 "stop": stop,
838 "store": store,
839 "stream": stream,
840 "stream_options": stream_options,
841 "temperature": temperature,
842 "tool_choice": tool_choice,
843 "tools": tools,
844 "top_logprobs": top_logprobs,
845 "top_p": top_p,
846 "user": user,
847 },
848 completion_create_params.CompletionCreateParams,
849 ),
850 options=make_request_options(
851 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
852 ),
853 cast_to=ChatCompletion,
854 stream=stream or False,
855 stream_cls=Stream[ChatCompletionChunk],
856 )
File ~\AppData\Roaming\Python\Python311\site-packages\openai\_base_client.py:1277, in SyncAPIClient.post(self, path, cast_to, body, options, files, stream, stream_cls)
1263 def post(
1264 self,
1265 path: str,
(...)
1272 stream_cls: type[_StreamT] | None = None,
1273 ) -> ResponseT | _StreamT:
1274 opts = FinalRequestOptions.construct(
1275 method="post", url=path, json_data=body, files=to_httpx_files(files), **options
1276 )
-> 1277 return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File ~\AppData\Roaming\Python\Python311\site-packages\openai\_base_client.py:954, in SyncAPIClient.request(self, cast_to, options, remaining_retries, stream, stream_cls)
951 else:
952 retries_taken = 0
--> 954 return self._request(
955 cast_to=cast_to,
956 options=options,
957 stream=stream,
958 stream_cls=stream_cls,
959 retries_taken=retries_taken,
960 )
File ~\AppData\Roaming\Python\Python311\site-packages\openai\_base_client.py:1058, in SyncAPIClient._request(self, cast_to, options, retries_taken, stream, stream_cls)
1055 err.response.read()
1057 log.debug("Re-raising status error")
-> 1058 raise self._make_status_error_from_response(err.response) from None
1060 return self._process_response(
1061 cast_to=cast_to,
1062 options=options,
(...)
1066 retries_taken=retries_taken,
1067 )
PermissionDeniedError:
Attention Required! | Cloudflare
body{margin:0;padding:0}
if (!navigator.cookieEnabled) {
window.addEventListener('DOMContentLoaded', function () {
var cookieEl = document.getElementById('cookie-alert');
cookieEl.style.display = 'block';
})
}
Sorry, you have been blocked
You are unable to access groq.com
Why have I been blocked?
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
What can I do to resolve this?
You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.
window._cf_translation = {};
```
Contributor guide
Assessment
This issue has not been assessed yet.