check edge case when options is empty
This commit is contained in:
parent
1cdaa284d6
commit
a6d42c043c
1 changed files with 63 additions and 1 deletions
|
|
@ -195,4 +195,66 @@ test("dropDownComponent", async ({ page }) => {
|
||||||
if (value !== "ai21.j2-ultra-v1") {
|
if (value !== "ai21.j2-ultra-v1") {
|
||||||
expect(false).toBeTruthy();
|
expect(false).toBeTruthy();
|
||||||
}
|
}
|
||||||
});
|
await page.getByTestId("code-button-modal").click();
|
||||||
|
await page
|
||||||
|
.locator("#CodeEditor div")
|
||||||
|
.filter({ hasText: "from typing import" })
|
||||||
|
.nth(1)
|
||||||
|
.click();
|
||||||
|
await page.locator("textarea").press("Control+a");
|
||||||
|
const emptyOptionsCode = `from typing import Optional
|
||||||
|
from langchain.llms.base import BaseLLM
|
||||||
|
from langchain_community.llms.bedrock import Bedrock
|
||||||
|
|
||||||
|
from langflow.interface.custom.custom_component import CustomComponent
|
||||||
|
|
||||||
|
|
||||||
|
class AmazonBedrockComponent(CustomComponent):
|
||||||
|
display_name: str = "Amazon Bedrock"
|
||||||
|
description: str = "LLM model from Amazon Bedrock."
|
||||||
|
icon = "Amazon"
|
||||||
|
|
||||||
|
def build_config(self):
|
||||||
|
return {
|
||||||
|
"model_id": {
|
||||||
|
"display_name": "Model Id",
|
||||||
|
"options": [],
|
||||||
|
},
|
||||||
|
"credentials_profile_name": {"display_name": "Credentials Profile Name"},
|
||||||
|
"streaming": {"display_name": "Streaming", "field_type": "bool"},
|
||||||
|
"endpoint_url": {"display_name": "Endpoint URL"},
|
||||||
|
"region_name": {"display_name": "Region Name"},
|
||||||
|
"model_kwargs": {"display_name": "Model Kwargs"},
|
||||||
|
"cache": {"display_name": "Cache"},
|
||||||
|
"code": {"advanced": True},
|
||||||
|
}
|
||||||
|
|
||||||
|
def build(
|
||||||
|
self,
|
||||||
|
model_id: str = "anthropic.claude-instant-v1",
|
||||||
|
credentials_profile_name: Optional[str] = None,
|
||||||
|
region_name: Optional[str] = None,
|
||||||
|
model_kwargs: Optional[dict] = None,
|
||||||
|
endpoint_url: Optional[str] = None,
|
||||||
|
streaming: bool = False,
|
||||||
|
cache: Optional[bool] = None,
|
||||||
|
) -> BaseLLM:
|
||||||
|
try:
|
||||||
|
output = Bedrock(
|
||||||
|
credentials_profile_name=credentials_profile_name,
|
||||||
|
model_id=model_id,
|
||||||
|
region_name=region_name,
|
||||||
|
model_kwargs=model_kwargs,
|
||||||
|
endpoint_url=endpoint_url,
|
||||||
|
streaming=streaming,
|
||||||
|
cache=cache,
|
||||||
|
) # type: ignore
|
||||||
|
except Exception as e:
|
||||||
|
raise ValueError("Could not connect to AmazonBedrock API.") from e
|
||||||
|
return output
|
||||||
|
|
||||||
|
`;
|
||||||
|
await page.locator("textarea").fill(emptyOptionsCode);
|
||||||
|
await page.getByRole('button', { name: 'Check & Save' }).click();
|
||||||
|
await page.getByText("No parameters are available for display.").isVisible();
|
||||||
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue