Skip to content

Commit

Permalink
feat: supported llama 3.1 models (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik authored Aug 12, 2024
1 parent f5d734f commit 9110dd8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ The following models support `POST SERVER_URL/openai/deployments/DEPLOYMENT_NAME
|Anthropic|Claude 2.1|anthropic.claude-v2:1|text-to-text|||||
|Anthropic|Claude 2|anthropic.claude-v2|text-to-text|||||
|Anthropic|Claude Instant 1.2|anthropic.claude-instant-v1|text-to-text|||||
|Meta|Llama 3.1 405B Instruct|meta.llama3-1-405b-instruct-v1:0|text-to-text|||||
|Meta|Llama 3.1 70B Instruct|meta.llama3-1-70b-instruct-v1:0|text-to-text|||||
|Meta|Llama 3.1 8B Instruct|meta.llama3-1-8b-instruct-v1:0|text-to-text|||||
|Meta|Llama 3 Chat 70B Instruct|meta.llama3-70b-instruct-v1:0|text-to-text|||||
|Meta|Llama 3 Chat 8B Instruct|meta.llama3-8b-instruct-v1:0|text-to-text|||||
|Meta|Llama 2 Chat 70B|meta.llama2-70b-chat-v1|text-to-text|||||
Expand Down
8 changes: 8 additions & 0 deletions aidial_adapter_bedrock/deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,29 @@

class ChatCompletionDeployment(str, Enum):
AMAZON_TITAN_TG1_LARGE = "amazon.titan-tg1-large"

AI21_J2_GRANDE_INSTRUCT = "ai21.j2-grande-instruct"
AI21_J2_JUMBO_INSTRUCT = "ai21.j2-jumbo-instruct"

ANTHROPIC_CLAUDE_INSTANT_V1 = "anthropic.claude-instant-v1"
ANTHROPIC_CLAUDE_V2 = "anthropic.claude-v2"
ANTHROPIC_CLAUDE_V2_1 = "anthropic.claude-v2:1"
ANTHROPIC_CLAUDE_V3_SONNET = "anthropic.claude-3-sonnet-20240229-v1:0"
ANTHROPIC_CLAUDE_V3_5_SONNET = "anthropic.claude-3-5-sonnet-20240620-v1:0"
ANTHROPIC_CLAUDE_V3_HAIKU = "anthropic.claude-3-haiku-20240307-v1:0"
ANTHROPIC_CLAUDE_V3_OPUS = "anthropic.claude-3-opus-20240229-v1:0"

STABILITY_STABLE_DIFFUSION_XL = "stability.stable-diffusion-xl"
STABILITY_STABLE_DIFFUSION_XL_V1 = "stability.stable-diffusion-xl-v1"

META_LLAMA2_13B_CHAT_V1 = "meta.llama2-13b-chat-v1"
META_LLAMA2_70B_CHAT_V1 = "meta.llama2-70b-chat-v1"
META_LLAMA3_8B_INSTRUCT_V1 = "meta.llama3-8b-instruct-v1:0"
META_LLAMA3_70B_INSTRUCT_V1 = "meta.llama3-70b-instruct-v1:0"
META_LLAMA3_1_405B_INSTRUCT_V1 = "meta.llama3-1-405b-instruct-v1:0"
META_LLAMA3_1_70B_INSTRUCT_V1 = "meta.llama3-1-70b-instruct-v1:0"
META_LLAMA3_1_8B_INSTRUCT_V1 = "meta.llama3-1-8b-instruct-v1:0"

COHERE_COMMAND_TEXT_V14 = "cohere.command-text-v14"
COHERE_COMMAND_LIGHT_TEXT_V14 = "cohere.command-light-text-v14"

Expand Down
3 changes: 3 additions & 0 deletions aidial_adapter_bedrock/llm/model/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ async def get_bedrock_adapter(
case (
ChatCompletionDeployment.META_LLAMA3_8B_INSTRUCT_V1
| ChatCompletionDeployment.META_LLAMA3_70B_INSTRUCT_V1
| ChatCompletionDeployment.META_LLAMA3_1_405B_INSTRUCT_V1
| ChatCompletionDeployment.META_LLAMA3_1_70B_INSTRUCT_V1
| ChatCompletionDeployment.META_LLAMA3_1_8B_INSTRUCT_V1
):
return MetaAdapter.create(
await Bedrock.acreate(region), model, llama3_config
Expand Down
5 changes: 4 additions & 1 deletion tests/integration_tests/test_chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def get_id(self):
ChatCompletionDeployment.META_LLAMA2_70B_CHAT_V1,
ChatCompletionDeployment.META_LLAMA3_8B_INSTRUCT_V1,
ChatCompletionDeployment.META_LLAMA3_70B_INSTRUCT_V1,
ChatCompletionDeployment.META_LLAMA3_1_405B_INSTRUCT_V1,
ChatCompletionDeployment.META_LLAMA3_1_70B_INSTRUCT_V1,
ChatCompletionDeployment.META_LLAMA3_1_8B_INSTRUCT_V1,
ChatCompletionDeployment.COHERE_COMMAND_TEXT_V14,
]

Expand Down Expand Up @@ -267,7 +270,7 @@ def test_case(
)

test_case(
name="max tokens 1",
name="pinocchio in one token",
max_tokens=1,
messages=[user("tell me the full story of Pinocchio")],
expected=lambda s: len(s.content.split()) <= 1,
Expand Down
3 changes: 3 additions & 0 deletions tests/unit_tests/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
(ChatCompletionDeployment.META_LLAMA2_70B_CHAT_V1, True, True),
(ChatCompletionDeployment.META_LLAMA3_8B_INSTRUCT_V1, True, True),
(ChatCompletionDeployment.META_LLAMA3_70B_INSTRUCT_V1, True, True),
(ChatCompletionDeployment.META_LLAMA3_1_405B_INSTRUCT_V1, True, True),
(ChatCompletionDeployment.META_LLAMA3_1_70B_INSTRUCT_V1, True, True),
(ChatCompletionDeployment.META_LLAMA3_1_8B_INSTRUCT_V1, True, True),
(ChatCompletionDeployment.COHERE_COMMAND_TEXT_V14, True, True),
(ChatCompletionDeployment.COHERE_COMMAND_LIGHT_TEXT_V14, True, True),
]
Expand Down

0 comments on commit 9110dd8

Please sign in to comment.