chore: Convert result to string in LLMCheckerChain, LLMMathChain, RetrievalQA, RetrievalQAWithSourcesChain, and SQLExecutor components
This commit is contained in:
parent
84d4772d5e
commit
789bdbb27e
5 changed files with 5 additions and 5 deletions
|
|
@ -26,6 +26,6 @@ class LLMCheckerChainComponent(CustomComponent):
|
|||
chain = LLMCheckerChain.from_llm(llm=llm)
|
||||
response = chain.invoke({chain.input_key: input_value})
|
||||
result = response.get(chain.output_key, "")
|
||||
result_str = Text(result)
|
||||
result_str = str(result)
|
||||
self.status = result_str
|
||||
return result_str
|
||||
|
|
|
|||
|
|
@ -42,6 +42,6 @@ class LLMMathChainComponent(CustomComponent):
|
|||
)
|
||||
response = chain.invoke({input_key: input_value})
|
||||
result = response.get(output_key)
|
||||
result_str = Text(result)
|
||||
result_str = str(result)
|
||||
self.status = result_str
|
||||
return result_str
|
||||
|
|
|
|||
|
|
@ -63,6 +63,6 @@ class RetrievalQAComponent(CustomComponent):
|
|||
references_str = self.create_references_from_data(data)
|
||||
result_str = result.get("result", "")
|
||||
|
||||
final_result = "\n".join([Text(result_str), references_str])
|
||||
final_result = "\n".join([str(result_str), references_str])
|
||||
self.status = final_result
|
||||
return final_result # OK
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class RetrievalQAWithSourcesChainComponent(CustomComponent):
|
|||
references_str = ""
|
||||
if return_source_documents:
|
||||
references_str = self.create_references_from_data(data)
|
||||
result_str = Text(result.get("answer", ""))
|
||||
result_str = str(result.get("answer", ""))
|
||||
final_result = "\n".join([result_str, references_str])
|
||||
self.status = final_result
|
||||
return final_result
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class SQLExecutorComponent(CustomComponent):
|
|||
result = tool.run(query, include_columns=include_columns)
|
||||
self.status = result
|
||||
except Exception as e:
|
||||
result = Text(e)
|
||||
result = str(e)
|
||||
self.status = result
|
||||
if not passthrough:
|
||||
raise e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue