Getting permission denied 403 error


PermissionDeniedError Traceback (most recent call last)
Cell In[14], line 3
1 base64_tools = encode_image_to_base64(“images/sanmanpid.jpg”)
----> 3 print(llama4(prompt,[f"data:image/jpeg;base64,{base64_tools}"]))

File ~/work/L3/utils.py:34, in llama4(prompt, image_urls, model)
30 content.extend(image_urls_content)
32 client = LlamaAPIClient(api_key=get_llama_api_key())
—> 34 response = client.chat.completions.create(
35 model=model,
36 messages=[{
37 “role”: “user”,
38 “content”: content
39 }],
40 temperature=0
41 )
43 return response.completion_message.content.text

File /usr/local/lib/python3.11/site-packages/llama_api_client/_utils/_utils.py:283, in required_args..inner..wrapper(*args, **kwargs)
281 msg = f"Missing required argument: {quote(missing[0])}"
282 raise TypeError(msg)
→ 283 return func(*args, **kwargs)

File /usr/local/lib/python3.11/site-packages/llama_api_client/resources/chat/completions.py:303, in CompletionsResource.create(self, messages, model, max_completion_tokens, repetition_penalty, response_format, stream, temperature, tool_choice, tools, top_k, top_p, user, extra_headers, extra_query, extra_body, timeout)
301 if stream:
302 extra_headers = {“Accept”: “text/event-stream”, **(extra_headers or {})}
→ 303 return self._post(
304 “/chat/completions”,
305 body=maybe_transform(
306 {
307 “messages”: messages,
308 “model”: model,
309 “max_completion_tokens”: max_completion_tokens,
310 “repetition_penalty”: repetition_penalty,
311 “response_format”: response_format,
312 “stream”: stream,
313 “temperature”: temperature,
314 “tool_choice”: tool_choice,
315 “tools”: tools,
316 “top_k”: top_k,
317 “top_p”: top_p,
318 “user”: user,
319 },
320 completion_create_params.CompletionCreateParamsStreaming
321 if stream
322 else completion_create_params.CompletionCreateParamsNonStreaming,
323 ),
324 options=make_request_options(
325 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
326 ),
327 cast_to=CreateChatCompletionResponse,
328 stream=stream or False,
329 stream_cls=Stream[CreateChatCompletionResponseStreamChunk],
330 )

File /usr/local/lib/python3.11/site-packages/llama_api_client/_base_client.py:1222, in SyncAPIClient.post(self, path, cast_to, body, options, files, stream, stream_cls)
1208 def post(
1209 self,
1210 path: str,
(…)
1217 stream_cls: type[_StreamT] | None = None,
1218 ) → ResponseT | _StreamT:
1219 opts = FinalRequestOptions.construct(
1220 method=“post”, url=path, json_data=body, files=to_httpx_files(files), **options
1221 )
→ 1222 return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))

File /usr/local/lib/python3.11/site-packages/llama_api_client/_base_client.py:1031, in SyncAPIClient.request(self, cast_to, options, stream, stream_cls)
1028 err.response.read()
1030 log.debug(“Re-raising status error”)
→ 1031 raise self._make_status_error_from_response(err.response) from None
1033 break
1035 assert response is not None, “could not resolve response (should never happen)”

PermissionDeniedError:

Forbidden (403)
<link rel="icon" href="/static/images/favicons/favicon.a66bc42b4e8a.ico">


<!-- Latest compiled and minified Bootstrap CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" integrity="sha512-GQGU0fMMi238uA+a/bdWJfpUGKUkBdgfFdgBm72SUQ6BeyWjoY/ton0tEjH+OSH9iP4Dfh+7HM0I9f5eR0L/4w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Your stuff: Third-party CSS libraries go here -->

<!-- This file stores project-specific CSS -->
<link href="/static/css/project.a9bf09099778.css" rel="stylesheet">

<!-- Le javascript
================================================== -->


  <!-- Bootstrap JS -->
  <script defer src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/js/bootstrap.min.js" integrity="sha512-OvBgP9A2JBgiRad/mM36mkzXSXaJE9BEIENnVEmeZdITvwT09xnxLtT4twkCa8m/loMbPHsvPl0T8lRGVBwjlQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  <!-- Your stuff: Third-party javascript libraries go here -->

  <!-- place project specific Javascript in this file -->
  <script defer src="/static/js/project.e8c1a24dd152.js"></script>
<div class="container">

Forbidden (403)

You're not allowed to access this page.

</div> <!-- /container -->