danilop / multimodal-chat

A multimodal chat interface with many tools.
MIT License
93 stars 11 forks source link

AccessDenied for claude and meta models. I was granted access earlier today. waiting a few hours. still an issue #7

Open cfregly opened 2 months ago

cfregly commented 2 months ago

Claude

{
    'modelId': 'anthropic.claude-3-5-sonnet-20240620-v1:0',
    'messages': [
        {
            'role': 'user',
            'content': [{'text': 'Find an image with a dog.'}]
        }
    ],
    'inferenceConfig': {'maxTokens': 4096, 'temperature': 0.5}
}
Thinking...
An error occurred (AccessDeniedException) when calling the Converse
operation: You don't have access to the model with the specified model ID.
Error: An error occurred (AccessDeniedException) when calling the Converse
operation: You don't have access to the model with the specified model ID.
Traceback (most recent call last):
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/route_utils.py", line 321, in call_process_api
    output = await app.get_blocks().process_api(

And llama3-8b

{
    'modelId': 'meta.llama3-1-8b-instruct-v1:0',
    'messages': [
        {
            'role': 'user',
            'content': [{'text': 'Find an image with a dog.'}]
        }
    ],
    'inferenceConfig': {'maxTokens': 4096, 'temperature': 0.5}
}
Thinking...
An error occurred (AccessDeniedException) when calling the Converse
operation: You don't have access to the model with the specified model ID.
Error: An error occurred (AccessDeniedException) when calling the Converse
operation: You don't have access to the model with the specified model ID.
Traceback (most recent call last):
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/route_utils.py", line 321, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/blocks.py", line 1935, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/blocks.py", line 1532, in call_function
    prediction = await utils.async_iteration(iterator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/utils.py", line 671, in async_iteration
    return await iterator.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/utils.py", line 776, in asyncgen_wrapper
    response = await iterator.__anext__()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/chat_interface.py", line 653, in _stream_fn
    first_response = await async_iteration(generator)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/utils.py", line 671, in async_iteration
    return await iterator.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/utils.py", line 664, in __anext__
    return await anyio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/gradio/utils.py", line 647, in run_sync_iterator_async
    return next(iterator)
           ^^^^^^^^^^^^^^
  File "/Users/admin/dev/multimodal-chat/multimodal_chat.py", line 1404, in chat_function
    response = run_loop(messages, system_prompt, temperature, state)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/dev/multimodal-chat/multimodal_chat.py", line 1355, in run_loop
    response_message = response['output']['message']
                       ~~~~~~~~^^^^^^^^^^
TypeError: string indices must be integers, not 'str'
cfregly commented 2 months ago

Claude

image

Llama 3.1 8B

image
danilop commented 2 months ago

That's strange but I don't think it depends on this code. Can you check the AWS Region? Does it work now?

cfregly commented 2 months ago

Region is correct. No idea what’s going on.