Update ec query and chat function (#996)

Co-authored-by: Deven Patel <deven298@yahoo.com>
This commit is contained in:
Deven Patel
2023-12-06 15:23:28 -08:00
committed by GitHub
parent e84b5034ea
commit 4a5ed1dd8d
2 changed files with 5 additions and 7 deletions

View File

@@ -512,6 +512,7 @@ class EmbedChain(JSONSerializable):
config: BaseLlmConfig = None, config: BaseLlmConfig = None,
dry_run=False, dry_run=False,
where: Optional[Dict] = None, where: Optional[Dict] = None,
citations: bool = False,
**kwargs: Dict[str, Any], **kwargs: Dict[str, Any],
) -> Union[Tuple[str, List[Tuple[str, str, str]]], str]: ) -> Union[Tuple[str, List[Tuple[str, str, str]]], str]:
""" """
@@ -536,10 +537,8 @@ class EmbedChain(JSONSerializable):
or the dry run result or the dry run result
:rtype: str, if citations is False, otherwise Tuple[str,List[Tuple[str,str,str]]] :rtype: str, if citations is False, otherwise Tuple[str,List[Tuple[str,str,str]]]
""" """
citations = kwargs.get("citations", False)
db_kwargs = {key: value for key, value in kwargs.items() if key != "citations"}
contexts = self._retrieve_from_database( contexts = self._retrieve_from_database(
input_query=input_query, config=config, where=where, citations=citations, **db_kwargs input_query=input_query, config=config, where=where, citations=citations, **kwargs
) )
if citations and len(contexts) > 0 and isinstance(contexts[0], tuple): if citations and len(contexts) > 0 and isinstance(contexts[0], tuple):
contexts_data_for_llm_query = list(map(lambda x: x[0], contexts)) contexts_data_for_llm_query = list(map(lambda x: x[0], contexts))
@@ -564,6 +563,7 @@ class EmbedChain(JSONSerializable):
config: Optional[BaseLlmConfig] = None, config: Optional[BaseLlmConfig] = None,
dry_run=False, dry_run=False,
where: Optional[Dict[str, str]] = None, where: Optional[Dict[str, str]] = None,
citations: bool = False,
**kwargs: Dict[str, Any], **kwargs: Dict[str, Any],
) -> Union[Tuple[str, List[Tuple[str, str, str]]], str]: ) -> Union[Tuple[str, List[Tuple[str, str, str]]], str]:
""" """
@@ -590,10 +590,8 @@ class EmbedChain(JSONSerializable):
or the dry run result or the dry run result
:rtype: str, if citations is False, otherwise Tuple[str,List[Tuple[str,str,str]]] :rtype: str, if citations is False, otherwise Tuple[str,List[Tuple[str,str,str]]]
""" """
citations = kwargs.get("citations", False)
db_kwargs = {key: value for key, value in kwargs.items() if key != "citations"}
contexts = self._retrieve_from_database( contexts = self._retrieve_from_database(
input_query=input_query, config=config, where=where, citations=citations, **db_kwargs input_query=input_query, config=config, where=where, citations=citations, **kwargs
) )
if citations and len(contexts) > 0 and isinstance(contexts[0], tuple): if citations and len(contexts) > 0 and isinstance(contexts[0], tuple):
contexts_data_for_llm_query = list(map(lambda x: x[0], contexts)) contexts_data_for_llm_query = list(map(lambda x: x[0], contexts))

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "embedchain" name = "embedchain"
version = "0.1.28" version = "0.1.29"
description = "Data platform for LLMs - Load, index, retrieve and sync any unstructured data" description = "Data platform for LLMs - Load, index, retrieve and sync any unstructured data"
authors = [ authors = [
"Taranjeet Singh <taranjeet@embedchain.ai>", "Taranjeet Singh <taranjeet@embedchain.ai>",