Update AmazonBedrockModel.py with new model options and remove unused code
This commit is contained in:
parent
754e74ec37
commit
1c55b8159b
1 changed files with 30 additions and 12 deletions
|
|
@ -10,31 +10,50 @@ class AmazonBedrockComponent(LCModelComponent):
|
||||||
display_name: str = "Amazon Bedrock"
|
display_name: str = "Amazon Bedrock"
|
||||||
description: str = "Generate text using LLM model from Amazon Bedrock."
|
description: str = "Generate text using LLM model from Amazon Bedrock."
|
||||||
icon = "Amazon"
|
icon = "Amazon"
|
||||||
|
field_order = [
|
||||||
|
"model_id",
|
||||||
|
"credentials_profile_name",
|
||||||
|
"region_name",
|
||||||
|
"model_kwargs",
|
||||||
|
"endpoint_url",
|
||||||
|
"cache",
|
||||||
|
"stream",
|
||||||
|
"input_value",
|
||||||
|
"system_message",
|
||||||
|
]
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
"model_id": {
|
"model_id": {
|
||||||
"display_name": "Model Id",
|
"display_name": "Model Id",
|
||||||
"options": [
|
"options": [
|
||||||
"ai21.j2-grande-instruct",
|
"amazon.titan-text-express-v1",
|
||||||
"ai21.j2-jumbo-instruct",
|
"amazon.titan-text-lite-v1",
|
||||||
"ai21.j2-mid",
|
"amazon.titan-embed-text-v1",
|
||||||
"ai21.j2-mid-v1",
|
"amazon.titan-embed-image-v1",
|
||||||
"ai21.j2-ultra",
|
"amazon.titan-image-generator-v1",
|
||||||
"ai21.j2-ultra-v1",
|
|
||||||
"anthropic.claude-instant-v1",
|
|
||||||
"anthropic.claude-v1",
|
|
||||||
"anthropic.claude-v2",
|
"anthropic.claude-v2",
|
||||||
|
"anthropic.claude-v2:1",
|
||||||
|
"anthropic.claude-3-sonnet-20240229-v1:0",
|
||||||
|
"anthropic.claude-3-haiku-20240307-v1:0",
|
||||||
|
"anthropic.claude-instant-v1",
|
||||||
|
"ai21.j2-mid-v1",
|
||||||
|
"ai21.j2-ultra-v1",
|
||||||
"cohere.command-text-v14",
|
"cohere.command-text-v14",
|
||||||
|
"cohere.command-light-text-v14",
|
||||||
|
"cohere.embed-english-v3",
|
||||||
|
"cohere.embed-multilingual-v3",
|
||||||
|
"meta.llama2-13b-chat-v1",
|
||||||
|
"meta.llama2-70b-chat-v1",
|
||||||
|
"mistral.mistral-7b-instruct-v0:2",
|
||||||
|
"mistral.mixtral-8x7b-instruct-v0:1",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"credentials_profile_name": {"display_name": "Credentials Profile Name"},
|
"credentials_profile_name": {"display_name": "Credentials Profile Name"},
|
||||||
"streaming": {"display_name": "Streaming", "field_type": "bool"},
|
|
||||||
"endpoint_url": {"display_name": "Endpoint URL"},
|
"endpoint_url": {"display_name": "Endpoint URL"},
|
||||||
"region_name": {"display_name": "Region Name"},
|
"region_name": {"display_name": "Region Name"},
|
||||||
"model_kwargs": {"display_name": "Model Kwargs"},
|
"model_kwargs": {"display_name": "Model Kwargs"},
|
||||||
"cache": {"display_name": "Cache"},
|
"cache": {"display_name": "Cache"},
|
||||||
"code": {"advanced": True},
|
|
||||||
"input_value": {"display_name": "Input"},
|
"input_value": {"display_name": "Input"},
|
||||||
"system_message": {"display_name": "System Message", "info": "System message to pass to the model."},
|
"system_message": {"display_name": "System Message", "info": "System message to pass to the model."},
|
||||||
"stream": {
|
"stream": {
|
||||||
|
|
@ -52,7 +71,6 @@ class AmazonBedrockComponent(LCModelComponent):
|
||||||
region_name: Optional[str] = None,
|
region_name: Optional[str] = None,
|
||||||
model_kwargs: Optional[dict] = None,
|
model_kwargs: Optional[dict] = None,
|
||||||
endpoint_url: Optional[str] = None,
|
endpoint_url: Optional[str] = None,
|
||||||
streaming: bool = False,
|
|
||||||
cache: Optional[bool] = None,
|
cache: Optional[bool] = None,
|
||||||
stream: bool = False,
|
stream: bool = False,
|
||||||
) -> Text:
|
) -> Text:
|
||||||
|
|
@ -63,7 +81,7 @@ class AmazonBedrockComponent(LCModelComponent):
|
||||||
region_name=region_name,
|
region_name=region_name,
|
||||||
model_kwargs=model_kwargs,
|
model_kwargs=model_kwargs,
|
||||||
endpoint_url=endpoint_url,
|
endpoint_url=endpoint_url,
|
||||||
streaming=streaming,
|
streaming=stream,
|
||||||
cache=cache,
|
cache=cache,
|
||||||
) # type: ignore
|
) # type: ignore
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue