Skip to content

Commit

Permalink
Merge pull request #487 from aws-samples/lvn
Browse files Browse the repository at this point in the history
feat: add model config
  • Loading branch information
NingLu authored Dec 19, 2024
2 parents ebeb71d + 5d6ada5 commit 8131a5c
Show file tree
Hide file tree
Showing 14 changed files with 611 additions and 513 deletions.
18 changes: 17 additions & 1 deletion source/lambda/online/common_logic/common_utils/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ToolRuningMode(ConstantBase):


class LLMModelType(ConstantBase):
DEFAULT = "default-model-id"
CLAUDE_INSTANCE = "anthropic.claude-instant-v1"
CLAUDE_2 = "anthropic.claude-v2"
CLAUDE_21 = "anthropic.claude-v2:1"
Expand All @@ -146,8 +147,23 @@ class LLMModelType(ConstantBase):
LLAMA3_2_90B_INSTRUCT = "us.meta.llama3-2-90b-instruct-v1:0"
MISTRAL_LARGE_2407 = "mistral.mistral-large-2407-v1:0"
COHERE_COMMAND_R_PLUS = "cohere.command-r-plus-v1:0"
# NOVA_PRO = "amazon.nova-pro-v1:0"
NOVA_PRO = "us.amazon.nova-pro-v1:0"
NOVA_LITE = "us.amazon.nova-lite-v1:0"
NOVA_MICRO = "us.amazon.nova-micro-v1:0"
CLAUDE_3_SONNET_US = "us.anthropic.claude-3-sonnet-20240229-v1:0"
CLAUDE_3_OPUS_US = "us.anthropic.claude-3-opus-20240229-v1:0"
CLAUDE_3_HAIKU_US = "us.anthropic.claude-3-haiku-20240307-v1:0"
CLAUDE_3_5_SONNET_V2_US = "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
CLAUDE_3_5_HAIKU_US = "us.anthropic.claude-3-5-haiku-20241022-v1:0"
CLAUDE_3_SONNET_EU = "eu.anthropic.claude-3-sonnet-20240229-v1:0"
CLAUDE_3_5_SONNET_EU = "eu.anthropic.claude-3-5-sonnet-20240620-v1:0"
CLAUDE_3_HAIKU_EU = "eu.anthropic.claude-3-haiku-20240307-v1:0"
CLAUDE_3_SONNET_APAC = "apac.anthropic.claude-3-sonnet-20240229-v1:0"
CLAUDE_3_5_SONNET_APAC = "apac.anthropic.claude-3-5-sonnet-20240620-v1:0"
CLAUDE_3_HAIKU_APAC = "apac.anthropic.claude-3-haiku-20240307-v1:0"
LLAMA3_1_70B_INSTRUCT_US = "us.meta.llama3-1-70b-instruct-v1:0"




class EmbeddingModelType(ConstantBase):
Expand Down
101 changes: 100 additions & 1 deletion source/lambda/online/common_logic/common_utils/prompt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.NOVA_PRO,

LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
]

EXPORT_SCENES = [
Expand Down Expand Up @@ -189,6 +204,20 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.NOVA_PRO,
LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
],
task_type=LLMTaskType.RAG,
prompt_template=CLAUDE_RAG_SYSTEM_PROMPT,
Expand Down Expand Up @@ -310,6 +339,20 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.NOVA_PRO,
LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
],
task_type=LLMTaskType.CONVERSATION_SUMMARY_TYPE,
prompt_template=CQR_SYSTEM_PROMPT,
Expand All @@ -335,6 +378,20 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.NOVA_PRO,
LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
],
task_type=LLMTaskType.CONVERSATION_SUMMARY_TYPE,
prompt_template=CQR_USER_PROMPT_TEMPLATE,
Expand All @@ -361,6 +418,20 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.NOVA_PRO,
LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
],
task_type=LLMTaskType.CONVERSATION_SUMMARY_TYPE,
prompt_template=json.dumps(CQR_FEW_SHOTS, ensure_ascii=False, indent=2),
Expand Down Expand Up @@ -479,6 +550,19 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.CLAUDE_3_5_SONNET_V2,
LLMModelType.CLAUDE_3_5_HAIKU,
LLMModelType.NOVA_PRO,
LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
# LLMModelType.LLAMA3_1_70B_INSTRUCT,
# LLMModelType.LLAMA3_2_90B_INSTRUCT,
# LLMModelType.MISTRAL_LARGE_2407,
Expand Down Expand Up @@ -511,7 +595,8 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.LLAMA3_1_70B_INSTRUCT,
LLMModelType.LLAMA3_2_90B_INSTRUCT,
LLMModelType.MISTRAL_LARGE_2407
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
],
task_type=LLMTaskType.TOOL_CALLING_API,
prompt_template=AGENT_SYSTEM_PROMPT_COHERE,
Expand All @@ -537,6 +622,20 @@ def prompt_template_render(self, prompt_template: dict):
LLMModelType.MISTRAL_LARGE_2407,
LLMModelType.COHERE_COMMAND_R_PLUS,
LLMModelType.NOVA_PRO,
LLMModelType.NOVA_LITE,
LLMModelType.NOVA_MICRO,
LLMModelType.CLAUDE_3_SONNET_US,
LLMModelType.CLAUDE_3_OPUS_US,
LLMModelType.CLAUDE_3_HAIKU_US,
LLMModelType.CLAUDE_3_5_SONNET_V2_US,
LLMModelType.CLAUDE_3_5_HAIKU_US,
LLMModelType.CLAUDE_3_SONNET_EU,
LLMModelType.CLAUDE_3_5_SONNET_EU,
LLMModelType.CLAUDE_3_HAIKU_EU,
LLMModelType.CLAUDE_3_SONNET_APAC,
LLMModelType.CLAUDE_3_5_SONNET_APAC,
LLMModelType.CLAUDE_3_HAIKU_APAC,
LLMModelType.LLAMA3_1_70B_INSTRUCT_US,
],
task_type=LLMTaskType.TOOL_CALLING_API,
prompt_template=TOOL_FEWSHOT_PROMPT,
Expand Down
Loading

0 comments on commit 8131a5c

Please sign in to comment.