Update AnthropicComponent configuration

This commit is contained in:
carlosrcoelho 2024-01-10 11:13:04 -03:00
commit ebe9cfc8a4

View file

@ -12,7 +12,8 @@ class AnthropicComponent(CustomComponent):
return { return {
"anthropic_api_key": { "anthropic_api_key": {
"display_name": "Anthropic API Key", "display_name": "Anthropic API Key",
"type": SecretStr, "type": str,
"password": True,
}, },
"anthropic_api_url": { "anthropic_api_url": {
"display_name": "Anthropic API URL", "display_name": "Anthropic API URL",
@ -20,7 +21,7 @@ class AnthropicComponent(CustomComponent):
}, },
"model_kwargs": { "model_kwargs": {
"display_name": "Model Kwargs", "display_name": "Model Kwargs",
"type": Dict[str, Any], "field_type": 'dict',
"advanced": True, "advanced": True,
}, },
"temperature": { "temperature": {
@ -31,7 +32,7 @@ class AnthropicComponent(CustomComponent):
def build( def build(
self, self,
anthropic_api_key: Optional[SecretStr], anthropic_api_key: Optional[str],
anthropic_api_url: Optional[str], anthropic_api_url: Optional[str],
model_kwargs: Optional[Dict[str, Any]], model_kwargs: Optional[Dict[str, Any]],
temperature: Optional[float] = None, temperature: Optional[float] = None,
@ -42,7 +43,7 @@ class AnthropicComponent(CustomComponent):
class Anthropic(BaseLanguageModel): class Anthropic(BaseLanguageModel):
def __init__( def __init__(
self, self,
api_key: Optional[SecretStr], api_key: Optional[str],
api_url: Optional[str], api_url: Optional[str],
model_kwargs: Optional[Dict[str, Any]] = None, model_kwargs: Optional[Dict[str, Any]] = None,
temperature: Optional[float] = None, temperature: Optional[float] = None,
@ -64,4 +65,4 @@ class AnthropicComponent(CustomComponent):
api_url=anthropic_api_url, api_url=anthropic_api_url,
model_kwargs=model_kwargs, model_kwargs=model_kwargs,
temperature=temperature, temperature=temperature,
) )