🔨 refactor(PromptRunner.py): remove unused inputs field from the component configuration

🔨 refactor(MetalRetriever.py): remove field_type code from params field in the component configuration
🔨 refactor(GetRequest.py): remove field_type code from headers field in the component configuration
🔨 refactor(PostRequest.py): remove field_type code from headers field in the component configuration
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-19 14:07:13 -03:00
commit 738bfa4812
4 changed files with 3 additions and 8 deletions

View file

@ -16,17 +16,14 @@ class PromptRunner(CustomComponent):
"info": "Make sure the prompt has all variables filled.", "info": "Make sure the prompt has all variables filled.",
}, },
"code": {"show": False}, "code": {"show": False},
"inputs": {"field_type": "code"},
} }
def build( def build(
self, self, llm: BaseLLM, prompt: PromptTemplate, inputs: dict = {}
llm: BaseLLM,
prompt: PromptTemplate,
) -> Document: ) -> Document:
chain = prompt | llm chain = prompt | llm
# The input is an empty dict because the prompt is already filled # The input is an empty dict because the prompt is already filled
result = chain.invoke({}) result = chain.invoke(input=inputs)
if hasattr(result, "content"): if hasattr(result, "content"):
result = result.content result = result.content
self.repr_value = result self.repr_value = result

View file

@ -14,7 +14,7 @@ class MetalRetrieverComponent(CustomComponent):
"api_key": {"display_name": "API Key", "password": True}, "api_key": {"display_name": "API Key", "password": True},
"client_id": {"display_name": "Client ID", "password": True}, "client_id": {"display_name": "Client ID", "password": True},
"index_id": {"display_name": "Index ID"}, "index_id": {"display_name": "Index ID"},
"params": {"display_name": "Parameters", "field_type": "code"}, "params": {"display_name": "Parameters"},
"code": {"show": False}, "code": {"show": False},
} }

View file

@ -19,7 +19,6 @@ class GetRequest(CustomComponent):
}, },
"headers": { "headers": {
"display_name": "Headers", "display_name": "Headers",
"field_type": "code",
"info": "The headers to send with the request.", "info": "The headers to send with the request.",
}, },
"code": {"show": False}, "code": {"show": False},

View file

@ -15,7 +15,6 @@ class PostRequest(CustomComponent):
"url": {"display_name": "URL", "info": "The URL to make the request to."}, "url": {"display_name": "URL", "info": "The URL to make the request to."},
"headers": { "headers": {
"display_name": "Headers", "display_name": "Headers",
"field_type": "code",
"info": "The headers to send with the request.", "info": "The headers to send with the request.",
}, },
"code": {"show": False}, "code": {"show": False},