Skip to content

Commit

Permalink
fixed merging conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-gan committed Feb 22, 2024
1 parent 2a006e4 commit 580cd70
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 1 addition & 3 deletions docs/docs/integrations/chat/groq.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@
"prompt = ChatPromptTemplate.from_messages([(\"system\", system), (\"human\", human)])\n",
"\n",
"chain = prompt | chat\n",
"chain.invoke({\n",
" \"text\": \"Explain the importance of low latency LLMs.\"\n",
"})"
"chain.invoke({\"text\": \"Explain the importance of low latency LLMs.\"})"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ def visit_comparison(self, comparison: Comparison) -> Dict:
]

if is_range_comparator:
return {
"range": {
field: {self._format_func(comparison.comparator): comparison.value}
}
}
value = comparison.value
if isinstance(comparison.value, dict) and "date" in comparison.value:
value = comparison.value["date"]
return {"range": {field: {self._format_func(comparison.comparator): value}}}

if comparison.comparator == Comparator.CONTAIN:
return {
Expand All @@ -85,6 +84,10 @@ def visit_comparison(self, comparison: Comparison) -> Dict:
# we want to use the keyword field
field = f"{field}.keyword" if isinstance(comparison.value, str) else field

if isinstance(comparison.value, dict):
if "date" in comparison.value:
comparison.value = comparison.value["date"]

return {self._format_func(comparison.comparator): {field: comparison.value}}

def visit_structured_query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def visit_comparison(self, comparison: Comparison) -> Dict:
def visit_structured_query(
self, structured_query: StructuredQuery
) -> Tuple[str, dict]:
print(structured_query)
print(structured_query) # noqa: T201
if structured_query.filter is None:
kwargs = {}
else:
Expand Down
3 changes: 2 additions & 1 deletion libs/core/langchain_core/sql_constructor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ def load_query_constructor_runnable(
Args:
llm: BaseLanguageModel to use for the chain.
document_contents: The contents of the document to be queried.
document_contents: Description of the page contents of the document to be
queried.
attribute_info: Sequence of attributes in the document.
examples: Optional list of examples to use for the chain.
allowed_comparators: Sequence of allowed comparators. Defaults to all
Expand Down

0 comments on commit 580cd70

Please sign in to comment.