Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: DAY 1 SUPPORT Add Claude -3 #2314

Closed
ishaan-jaff opened this issue Mar 4, 2024 · 75 comments
Closed

[Feature]: DAY 1 SUPPORT Add Claude -3 #2314

ishaan-jaff opened this issue Mar 4, 2024 · 75 comments
Labels
enhancement New feature or request

Comments

@ishaan-jaff
Copy link
Contributor

The Feature

Motivation, pitch

New model

Twitter / LinkedIn details

No response

@ishaan-jaff ishaan-jaff added the enhancement New feature or request label Mar 4, 2024
@krrishdholakia krrishdholakia pinned this issue Mar 4, 2024
@krrishdholakia krrishdholakia changed the title [Feature]: Add Claude -3 [Feature]: DAY 1 SUPPORT Add Claude -3 Mar 4, 2024
@ishaan-jaff
Copy link
Contributor Author

We'll need to add the messages endpoint for claude3 - it fails on their completion endpoint

Error calling model: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"\"claude-3-opus-20240229\" is not supported on this API. Please use the Messages API instead."}}
 

@krrishdholakia
Copy link
Contributor

No bedrock support yet.
Screenshot 2024-03-04 at 6 48 09 AM

@krrishdholakia
Copy link
Contributor

I don't think the legacy text completion endpoint supports claude 3. We should move to using the anthropic 2.1 endpoint - #1209

@krrishdholakia
Copy link
Contributor

You can also send images in claude 3 - will need to add pricing for this

Screenshot 2024-03-04 at 6 49 45 AM

@krrishdholakia
Copy link
Contributor

support tool calling - https://github.com/anthropics/anthropic-cookbook/blob/main/function_calling/function_calling.ipynb

@ishaan-jaff
Copy link
Contributor Author

Action Items:

@ishaan-jaff
Copy link
Contributor Author

PR to add initial support : #2315

@ishaan-jaff
Copy link
Contributor Author

Model Pricing info here for reference https://docs.anthropic.com/claude/docs/models-overview#meet-claude-3

@krrishdholakia
Copy link
Contributor

I'll take care of the image + tool calling cost tracking in my PR

@krrishdholakia
Copy link
Contributor

Screenshot 2024-03-04 at 7 39 44 AM

@ishaan-jaff
Copy link
Contributor Author

ishaan-jaff commented Mar 4, 2024

Notes about the /messages endpoint

  • Anthropic Deprecated support for claude-instant-1 on the new messages endpoint
  1. Anthropic supports roles like "user" and "assistant",
  2. The first message always needs to be of role "user"
  3. Each message must alternate between "user" and "assistant"
  1. Each message must alternate between "user" and "assistant"

For v0 PR not addressing no.3

@ashot
Copy link

ashot commented Mar 4, 2024

Sorry if this is a silly question but does day 1 support mean you guy are hoping to get this done today? Just wondering if I should attempt to hack something myself.
This project is awesome btw.

@ishaan-jaff
Copy link
Contributor Author

@ashot it will be live in 1-2 hours, PR for v0 support is here: https://github.com/BerriAI/litellm/pull/2315/files

@ashot
Copy link

ashot commented Mar 4, 2024

love it, thank you!

@haseeb-heaven
Copy link
Contributor

Wow great one waiting to test Claude-3 in my code interpreter.

@ishaan-jaff
Copy link
Contributor Author

Working v0 PR is live here: 14fc835

@krrishdholakia
Copy link
Contributor

@ishaan-jaff is this ready for me to stack the tool calling + image calling PRs on this?

@ishaan-jaff
Copy link
Contributor Author

Yes @krrishdholakia

@krrishdholakia
Copy link
Contributor

krrishdholakia commented Mar 4, 2024

@ishaan-jaff looks like there's a separate param for system prompt
Screenshot 2024-03-04 at 9 54 08 AM

@krrishdholakia
Copy link
Contributor

V1 needs to add:

  • support for system prompt
  • Support for tool calling
  • Support for image calls

@ishaan-jaff
Copy link
Contributor Author

confirmed 1.28.13 has v0 support working
Screenshot 2024-03-04 at 9 57 12 AM

@ishaan-jaff
Copy link
Contributor Author

@ishaan-jaff looks like there's a separate param for system prompt

oh missed this, will your v1 PR cover this @krrishdholakia ? else I can make the fix

@krrishdholakia
Copy link
Contributor

yea i'm fixing it for tool calling

@ishaan-jaff
Copy link
Contributor Author

FYI Anthropic deprecated the following models on /messages

  • claude-2 (anthropic recommends using claude-2.1)
  • claude-instant-1 (anthropic recommends using claude-instant-1.2)

Since we moved everything to /messages this means litellm will not support claude-2 and claude-instant-1

@krrishdholakia
Copy link
Contributor

That's funny - claude instant 1.2 works
Screenshot 2024-03-04 at 10 14 50 AM

@ishaan-jaff
Copy link
Contributor Author

Yup - Lets put a notice on the latest release about this and see if users want us to maintain - Claude-instant-1 and Claude-2

@ishaan-jaff
Copy link
Contributor Author

@xihajun
Copy link
Contributor

xihajun commented Mar 4, 2024

@ishaan-jaff thanks!

There seemed to be a bug with system prompt enabled + multiple conversations

[{"role":"system","content":"test"},{"role":"user","content":"test"},{"role":"assistant","content":"te st"},{"role":"user","content":"test"}]

completion(model="claude-3-opus-20240229", messages=[{"role":"system","content":"test"}, {"role":"user","content":"test"},{"role":"assistant","content":"test"}],stream=True)
Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm.set_verbose=True'.

*** litellm.exceptions.BadRequestError: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"messages: roles must alternate between \"user\" and \"assistant\", but found multiple \"assistant\" roles in a row"}}

It looks like it has some bugs, ['system', 'user', 'assistant', 'user', 'assistant', 'user'] my role is doing alternate between \"user\" and \"assistant\"? Any idea why is that?

@haseeb-heaven
Copy link
Contributor

haseeb-heaven commented Mar 4, 2024

i got this error while testing this API.

Python code:

import os
from litellm import completion
from dotenv import load_dotenv

# load.env file
def init_env():
    load_dotenv()
    
    api_key = os.getenv("ANTHROPIC_API_KEY")
    
    # set env - [OPTIONAL] replace with your anthropic key
    os.environ["ANTHROPIC_API_KEY"] = api_key
    
if __name__ == "__main__":
    init_env()
    try:
        model = "claude-3-sonnet-20240229"
        messages = [{"role": "user", "content": "Hey! how's it going?"}]
        response = completion(model=model, messages=messages)
        print(response)
    except Exception as exception:
        import traceback as tb
        print(tb.format_exc())
        print(exception)
python claude_demo.py
/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field "model_max_budget" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm.set_verbose=True'.

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/main.py", line 1028, in completion
    response = anthropic.completion(
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/llms/anthropic.py", line 170, in completion
    raise AnthropicError(
litellm.llms.anthropic.AnthropicError: {"type":"error","error":{"type":"invalid_request_error","message":"\"claude-3-sonnet-20240229\" is not supported on this API. Please use the Messages API instead."}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/haseeb-mir/Documents/Code/Python/code-interpreter/claude_demo.py", line 19, in <module>
    response = completion(model=model, messages=messages)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 2621, in wrapper
    raise e
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 2524, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/main.py", line 1908, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 7766, in exception_type
    raise e
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 6699, in exception_type
    raise BadRequestError(
litellm.exceptions.BadRequestError: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"\"claude-3-sonnet-20240229\" is not supported on this API. Please use the Messages API instead."}}

AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"\"claude-3-sonnet-20240229\" is not supported on this API. Please use the Messages API instead."}}

@haseeb-heaven
Copy link
Contributor

haseeb-heaven commented Mar 4, 2024

Python code.

import os
from litellm import completion
from dotenv import load_dotenv

# load.env file
def init_env():
    load_dotenv()
    
    api_key = os.getenv("ANTHROPIC_API_KEY")
    if not api_key:
        raise Exception("Missing ANTHROPIC_API_KEY in.env file")
    
if __name__ == "__main__":
    init_env()
    try:
        model="claude-3-sonnet-20240229",
        prompt = "Write code to find prime number in given range."
        
        messages=[
            {
                "role": "user",
                "content": [
                    {
                        "type": "text",
                        "text": prompt
                    }
                ]
            }
        ]
        
        response = completion(model=model, messages=messages)
        print(response)
    except Exception as exception:
        print(f"Exception occured: {exception}")
        import traceback
        print(traceback.format_exc())

Now i tested and got more error from LiteLLM now.

(heaven-env)% python claude_demo.py
/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field "model_max_budget" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm.set_verbose=True'.

Exception occured: GetLLMProvider Exception - 'tuple' object has no attribute 'split'

original model: ('claude-3-sonnet-20240229',)
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 4981, in get_llm_provider
    model.split("/", 1)[0] in litellm.provider_list
    ^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'split'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/main.py", line 601, in completion
    model, custom_llm_provider, dynamic_api_key, api_base = get_llm_provider(
                                                            ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 5148, in get_llm_provider
    raise litellm.exceptions.BadRequestError(  # type: ignore
litellm.exceptions.BadRequestError: GetLLMProvider Exception - 'tuple' object has no attribute 'split'

original model: ('claude-3-sonnet-20240229',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/haseeb-mir/Documents/Code/Python/code-interpreter/claude_demo.py", line 31, in <module>
    response = completion(model=model, messages=messages)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 2621, in wrapper
    raise e
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 2524, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/main.py", line 1908, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 7767, in exception_type
    raise e
  File "/opt/homebrew/Caskroom/miniforge/base/envs/heaven-env/lib/python3.11/site-packages/litellm/utils.py", line 7735, in exception_type
    raise APIConnectionError(
litellm.exceptions.APIConnectionError: GetLLMProvider Exception - 'tuple' object has no attribute 'split'

original model: ('claude-3-sonnet-20240229',)

@xihajun
Copy link
Contributor

xihajun commented Mar 4, 2024

@haseeb-heaven have you pip installed the latest version

@haseeb-heaven
Copy link
Contributor

@haseeb-heaven have you pip installed the latest version

Yes.
LiteLLM: Current Version = 1.28.13

@haseeb-heaven
Copy link
Contributor

Code now working fine .

import os
from litellm import completion
from dotenv import load_dotenv
import litellm

# load.env file
def init_env():
    load_dotenv()
    
    api_key = os.getenv("ANTHROPIC_API_KEY")
    if not api_key:
        raise Exception("Missing ANTHROPIC_API_KEY in.env file")
    
if __name__ == "__main__":
    init_env()
    litellm.set_verbose=True
    try:
        model="claude-3-sonnet-20240229"
        prompt = "Write code to find prime number in given range."
        
        messages=[
                {
                    "role": "user",
                    "content": [
                        {
                            "type": "text",
                            "text": prompt
                        }
                    ]
                }
            ]
        
        response = completion(model=model, messages=messages)
        print(response)
    except Exception as exception:
        print(f"Exception occured: {exception}")

@xihajun
Copy link
Contributor

xihajun commented Mar 4, 2024

If you try with system, and add a few messages it might fail?

@krrishdholakia
Copy link
Contributor

@xihajun system prompt support + tool calling + image calling just pushed - #2320

Should be out in the next release by EOD

@CXwudi
Copy link

CXwudi commented Mar 5, 2024

You guys are just awesome, can't believe a model support with vision and function calling, plus different provider (AWS) are all done in 12 hours

@SamArgillander
Copy link

Does this already work on the proxy side, or is it just me that gets stuck?

@krrishdholakia
Copy link
Contributor

@SamArgillander Bedrock just got merged, should be out soon. Anthropic API is already live in https://github.com/BerriAI/litellm/releases/tag/v1.29.1

What's the error?

@adamrb
Copy link

adamrb commented Mar 5, 2024

Also getting errors on Bedrock. It seems LiteLLM needs to be updated to call the new messages API.

botocore.exceptions.EventStreamError: An error occurred (validationException) when calling the InvokeModelWithResponseStream operation: "claude-3-sonnet-20240229" is not supported on this API. Please use the Messages API instead.

@haseeb-heaven
Copy link
Contributor

Also getting errors on Bedrock. It seems LiteLLM needs to be updated to call the new messages API.

botocore.exceptions.EventStreamError: An error occurred (validationException) when calling the InvokeModelWithResponseStream operation: "claude-3-sonnet-20240229" is not supported on this API. Please use the Messages API instead.

Try this code format for Messages API.

if __name__ == "__main__":
    try:
        model="claude-3-sonnet-20240229"
        prompt = "Write code to find prime number in given range."
        
        messages=[
                {
                    "role": "user",
                    "content": [
                        {
                            "type": "text",
                            "text": prompt
                        }
                    ]
                }
            ]
        
        response = completion(model=model, messages=messages)
        print(response)
    except Exception as exception:
        print(f"Exception occured: {exception}")

@quan2005
Copy link

quan2005 commented Mar 6, 2024

  1. This code will throw an error when the function does not return its complete output.

image

  1. when the response include function call , the content will lose

@shaggy2626
Copy link

shaggy2626 commented Mar 6, 2024

Not sure if this is the correct location to post on but when using with code interpreter and on the latest version of litellm I'm receiving messages

{"type":"error","error":{"type":"invalid_request_error","message":"messages: all messages must have non-empty content except for
the optional final assistant message"}}

interpreter works for the first response but once it executes the codes I'm getting the message about having blank messages being sent.

    for chunk in interpreter.chat(message, display=False, stream=True):
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\core.py", line 148, in
_streaming_chat
    yield from self._respond_and_store()
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\core.py", line 194, in
_respond_and_store
    for chunk in respond(self):
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\respond.py", line 49, in respond
    for chunk in interpreter.llm.run(messages_for_llm):
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\llm\llm.py", line 198, in run
    yield from run_text_llm(self, params)
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\llm\run_text_llm.py", line 19, in
run_text_llm
    for chunk in llm.completions(**params):
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\llm\llm.py", line 229, in
fixed_litellm_completions
    raise first_error
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\interpreter\core\llm\llm.py", line 210, in
fixed_litellm_completions
    yield from litellm.completion(**params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 2647, in wrapper
    raise e
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 2550, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\main.py", line 1936, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 7839, in exception_type
    raise e
  File "C:\Users\abc40\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 6772, in exception_type
    raise BadRequestError(
litellm.exceptions.BadRequestError: AnthropicException -
{"type":"error","error":{"type":"invalid_request_error","message":"messages: all messages must have non-empty content except for
the optional final assistant message"}}


  from datetime import datetime

  current_time = datetime.now()
  print(f"The current time is: {current_time.strftime('%I:%M %p')}")


  The current time is: 03:13 AM

[IPKernelApp] WARNING | Parent appears to have exited, shutting down.
PS C:\Users\abc40>

@themrzmaster
Copy link
Contributor

I am having a lot of issues as well.

Erro: BedrockException - An error occurred (ValidationException) when calling the InvokeModel operation: messages.3.tool_calls: Extra inputs are not permitted

the tool_calls from openai api does not work here

@themrzmaster
Copy link
Contributor

I guess it should be handled using the function_results tag, as shown on the notebook https://github.com/anthropics/anthropic-cookbook/blob/main/function_calling/function_calling.ipynb:

def construct_successful_function_run_injection_prompt(invoke_results):
    constructed_prompt = (
        "<function_results>\n"
        + '\n'.join(
            f"<result>\n<tool_name>{res['tool_name']}</tool_name>\n<stdout>\n{res['tool_result']}\n</stdout>\n</result>" 
            for res in invoke_results
        ) + "\n</function_results>"
    )
    
    return constructed_prompt

formatted_results = [{
    'tool_name': 'do_pairwise_arithmetic',
    'tool_result': result
}]
function_results = construct_successful_function_run_injection_prompt(formatted_results)
print(function_results)

@krrishdholakia
Copy link
Contributor

@themrzmaster can you confirm which version of litellm your on? This works for me on the latest one:

def test_bedrock_claude_3_tool_calling():
    try:
        litellm.set_verbose = True
        tools = [
            {
                "type": "function",
                "function": {
                    "name": "get_current_weather",
                    "description": "Get the current weather in a given location",
                    "parameters": {
                        "type": "object",
                        "properties": {
                            "location": {
                                "type": "string",
                                "description": "The city and state, e.g. San Francisco, CA",
                            },
                            "unit": {
                                "type": "string",
                                "enum": ["celsius", "fahrenheit"],
                            },
                        },
                        "required": ["location"],
                    },
                },
            }
        ]
        messages = [
            {"role": "user", "content": "What's the weather like in Boston today?"}
        ]
        response: ModelResponse = completion(
            model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
            messages=messages,
            tools=tools,
            tool_choice="auto",
        )
        print(f"response: {response}")
        # Add any assertions here to check the response
        assert isinstance(response.choices[0].message.tool_calls[0].function.name, str)
        assert isinstance(
            response.choices[0].message.tool_calls[0].function.arguments, str
        )
    except RateLimitError:
        pass
    except Exception as e:
        pytest.fail(f"Error occurred: {e}")

@krrishdholakia
Copy link
Contributor

hey @themrzmaster @quan2005 @shaggy2626

noting the issues:

  1. I'll move to checking if function_results is in the response.
  2. Claude can include the content as part of the function call response - e.g. "Seems like the weather in boston is <function_call> .. </function_call> might be worth bringing a jacket" -> how should this be parsed into content? Would you just want the content to include the exact message from claude and the function call to have the extracted values?

@adamrb
Copy link

adamrb commented Mar 6, 2024

I primarily use LiteLLM as a Proxy for LibreChat. I'm now getting responses from Bedrock for Claude 3, but it seems there's an error with the proxy.

RAW RESPONSE:
{"id": "xxxxxxxxxxx", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "Hello! How can I assist you today?"}], "model": "claude-3-sonnet-28k-20240229", "stop_reason": "end_turn", "stop_sequence": null, "usage": {"input_tokens": 275, "output_tokens": 12}}

raw model_response: {'ResponseMetadata': {'RequestId': 'xxxxxxxxxxxx', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Wed, 06 Mar 2024 17:53:50 GMT', 'content-type': 'application/json', 'content-length': '278', 'connection': 'keep-alive', 'x-amzn-requestid': 'xxxxxxxxxxx', 'x-amzn-bedrock-invocation-latency': '5050', 'x-amzn-bedrock-output-token-count': '12', 'x-amzn-bedrock-input-token-count': '275'}, 'RetryAttempts': 0}, 'contentType': 'application/json', 'body': <botocore.response.StreamingBody object at 0xffff915ff1f0>}
model_response._hidden_params: {'custom_llm_provider': 'bedrock', 'region_name': 'us-west-2'}
INFO: 18.246.250.106:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Traceback (most recent call last):
File "/home/ec2-user/.local/lib/python3.9/site-packages/litellm/proxy/proxy_server.py", line 2231, in async_data_generator
async for chunk in response:
TypeError: 'async for' requires an object with aiter method, got ModelResponse

@krrishdholakia
Copy link
Contributor

@ashot working on adding streaming bedrock claude 3 support today - #2362. Will update you once it's out.

@pchalasani
Copy link
Contributor

pchalasani commented Mar 7, 2024

adding streaming bedrock

Not sure if this is known (I haven't read the full thread above), but streaming is not working with claude-3, even outside of bedrock. I get an error saying unable to parse response when using these kwargs in the completion call:

image

this is the error

image

@pchalasani
Copy link
Contributor

streaming is not working with claude-3,

Please ignore, it seems fine now. Might have been an Anthropic API issue.

@shaggy2626
Copy link

hey @themrzmaster @quan2005 @shaggy2626

noting the issues:

1. I'll move to checking if `function_results` is in the response.

2. Claude can include the content as part of the function call response - e.g. `"Seems like the weather in boston is <function_call> .. </function_call> might be worth bringing a jacket"` -> how should this be parsed into content? Would you just want the content to include the exact message from claude and the function call to have the extracted values?

im not sure how to answer that as im only using it in Open Interpreter. i included the output from terminal for your review. My prompt was "what time is it". I also did see something about my api key being invalid however the key is valid and i confirmed by looking at the usage in the Claude portal.
claudeissuePowerShell.txt

@krrishdholakia
Copy link
Contributor

closing as the work for this ticket is complete

https://docs.litellm.ai/docs/providers/anthropic

https://docs.litellm.ai/docs/providers/bedrock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests