refactor: Update model variable names and improve code readability in AmazonBedrockModel, AnthropicModel, BaiduQianfanChatModel, and GroqModel
This commit is contained in:
parent
d8bd09661a
commit
ae3170101b
4 changed files with 14 additions and 16 deletions
|
|
@ -15,7 +15,7 @@ class AmazonBedrockComponent(LCModelComponent):
|
||||||
MessageInput(name="input_value", display_name="Input"),
|
MessageInput(name="input_value", display_name="Input"),
|
||||||
DropdownInput(
|
DropdownInput(
|
||||||
name="model_id",
|
name="model_id",
|
||||||
display_name="Model Id",
|
display_name="Model ID",
|
||||||
options=[
|
options=[
|
||||||
"amazon.titan-text-express-v1",
|
"amazon.titan-text-express-v1",
|
||||||
"amazon.titan-text-lite-v1",
|
"amazon.titan-text-lite-v1",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from pydantic.v1 import SecretStr
|
||||||
from langflow.base.constants import STREAM_INFO_TEXT
|
from langflow.base.constants import STREAM_INFO_TEXT
|
||||||
from langflow.base.models.model import LCModelComponent
|
from langflow.base.models.model import LCModelComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Text
|
from langflow.field_typing import BaseLanguageModel, Text
|
||||||
from langflow.io import BoolInput, DropdownInput, FloatInput, IntInput, Output, SecretStrInput, StrInput
|
from langflow.io import BoolInput, DropdownInput, FloatInput, IntInput, Output, SecretStrInput, TextInput
|
||||||
|
|
||||||
|
|
||||||
class AnthropicModelComponent(LCModelComponent):
|
class AnthropicModelComponent(LCModelComponent):
|
||||||
|
|
@ -13,7 +13,7 @@ class AnthropicModelComponent(LCModelComponent):
|
||||||
icon = "Anthropic"
|
icon = "Anthropic"
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
StrInput(name="input_value", display_name="Input", input_types=["Text", "Data", "Prompt", "Message"]),
|
TextInput(name="input_value", display_name="Input"),
|
||||||
IntInput(
|
IntInput(
|
||||||
name="max_tokens",
|
name="max_tokens",
|
||||||
display_name="Max Tokens",
|
display_name="Max Tokens",
|
||||||
|
|
@ -42,20 +42,20 @@ class AnthropicModelComponent(LCModelComponent):
|
||||||
info="Your Anthropic API key.",
|
info="Your Anthropic API key.",
|
||||||
),
|
),
|
||||||
FloatInput(name="temperature", display_name="Temperature", value=0.1),
|
FloatInput(name="temperature", display_name="Temperature", value=0.1),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="anthropic_api_url",
|
name="anthropic_api_url",
|
||||||
display_name="Anthropic API URL",
|
display_name="Anthropic API URL",
|
||||||
advanced=True,
|
advanced=True,
|
||||||
info="Endpoint of the Anthropic API. Defaults to 'https://api.anthropic.com' if not specified.",
|
info="Endpoint of the Anthropic API. Defaults to 'https://api.anthropic.com' if not specified.",
|
||||||
),
|
),
|
||||||
BoolInput(name="stream", display_name="Stream", info=STREAM_INFO_TEXT, advanced=True),
|
BoolInput(name="stream", display_name="Stream", info=STREAM_INFO_TEXT, advanced=True),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="system_message",
|
name="system_message",
|
||||||
display_name="System Message",
|
display_name="System Message",
|
||||||
info="System message to pass to the model.",
|
info="System message to pass to the model.",
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="prefill",
|
name="prefill",
|
||||||
display_name="Prefill",
|
display_name="Prefill",
|
||||||
info="Prefill text to guide the model's response.",
|
info="Prefill text to guide the model's response.",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from pydantic.v1 import SecretStr
|
||||||
from langflow.base.constants import STREAM_INFO_TEXT
|
from langflow.base.constants import STREAM_INFO_TEXT
|
||||||
from langflow.base.models.model import LCModelComponent
|
from langflow.base.models.model import LCModelComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Text
|
from langflow.field_typing import BaseLanguageModel, Text
|
||||||
from langflow.io import BoolInput, FloatInput, Output, SecretStrInput, StrInput, DropdownInput
|
from langflow.io import BoolInput, FloatInput, Output, SecretStrInput, TextInput, DropdownInput
|
||||||
|
|
||||||
|
|
||||||
class QianfanChatEndpointComponent(LCModelComponent):
|
class QianfanChatEndpointComponent(LCModelComponent):
|
||||||
|
|
@ -14,10 +14,9 @@ class QianfanChatEndpointComponent(LCModelComponent):
|
||||||
icon = "BaiduQianfan"
|
icon = "BaiduQianfan"
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
StrInput(
|
TextInput(
|
||||||
name="input_value",
|
name="input_value",
|
||||||
display_name="Input",
|
display_name="Input",
|
||||||
input_types=["Text", "Data", "Prompt"],
|
|
||||||
),
|
),
|
||||||
DropdownInput(
|
DropdownInput(
|
||||||
name="model",
|
name="model",
|
||||||
|
|
@ -67,7 +66,7 @@ class QianfanChatEndpointComponent(LCModelComponent):
|
||||||
value=1.0,
|
value=1.0,
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="endpoint",
|
name="endpoint",
|
||||||
display_name="Endpoint",
|
display_name="Endpoint",
|
||||||
info="Endpoint of the Qianfan LLM, required if custom model used.",
|
info="Endpoint of the Qianfan LLM, required if custom model used.",
|
||||||
|
|
@ -78,7 +77,7 @@ class QianfanChatEndpointComponent(LCModelComponent):
|
||||||
info=STREAM_INFO_TEXT,
|
info=STREAM_INFO_TEXT,
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="system_message",
|
name="system_message",
|
||||||
display_name="System Message",
|
display_name="System Message",
|
||||||
info="System message to pass to the model.",
|
info="System message to pass to the model.",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from langflow.base.constants import STREAM_INFO_TEXT
|
||||||
from langflow.base.models.groq_constants import MODEL_NAMES
|
from langflow.base.models.groq_constants import MODEL_NAMES
|
||||||
from langflow.base.models.model import LCModelComponent
|
from langflow.base.models.model import LCModelComponent
|
||||||
from langflow.field_typing import BaseLanguageModel, Text
|
from langflow.field_typing import BaseLanguageModel, Text
|
||||||
from langflow.io import BoolInput, DropdownInput, FloatInput, IntInput, Output, SecretStrInput, StrInput
|
from langflow.io import BoolInput, DropdownInput, FloatInput, IntInput, Output, SecretStrInput, TextInput
|
||||||
|
|
||||||
|
|
||||||
class GroqModel(LCModelComponent):
|
class GroqModel(LCModelComponent):
|
||||||
|
|
@ -19,7 +19,7 @@ class GroqModel(LCModelComponent):
|
||||||
display_name="Groq API Key",
|
display_name="Groq API Key",
|
||||||
info="API key for the Groq API.",
|
info="API key for the Groq API.",
|
||||||
),
|
),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="groq_api_base",
|
name="groq_api_base",
|
||||||
display_name="Groq API Base",
|
display_name="Groq API Base",
|
||||||
info="Base URL path for API requests, leave blank if not using a proxy or service emulator.",
|
info="Base URL path for API requests, leave blank if not using a proxy or service emulator.",
|
||||||
|
|
@ -49,11 +49,10 @@ class GroqModel(LCModelComponent):
|
||||||
info="The name of the model to use.",
|
info="The name of the model to use.",
|
||||||
options=MODEL_NAMES,
|
options=MODEL_NAMES,
|
||||||
),
|
),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="input_value",
|
name="input_value",
|
||||||
display_name="Input",
|
display_name="Input",
|
||||||
info="The input to the model.",
|
info="The input to the model.",
|
||||||
input_types=["Text", "Data", "Prompt"],
|
|
||||||
),
|
),
|
||||||
BoolInput(
|
BoolInput(
|
||||||
name="stream",
|
name="stream",
|
||||||
|
|
@ -61,7 +60,7 @@ class GroqModel(LCModelComponent):
|
||||||
info=STREAM_INFO_TEXT,
|
info=STREAM_INFO_TEXT,
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
StrInput(
|
TextInput(
|
||||||
name="system_message",
|
name="system_message",
|
||||||
display_name="System Message",
|
display_name="System Message",
|
||||||
info="System message to pass to the model.",
|
info="System message to pass to the model.",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue