mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 13:33:37 +00:00
@@ -187,7 +187,7 @@ def _load_package_modules(
|
||||
modules_by_namespace[top_namespace] = _module_members
|
||||
|
||||
except ImportError as e:
|
||||
print(f"Error: Unable to import module '{namespace}' with error: {e}") # noqa: T201
|
||||
print(f"Error: Unable to import module '{namespace}' with error: {e}")
|
||||
|
||||
return modules_by_namespace
|
||||
|
||||
|
@@ -300,7 +300,7 @@
|
||||
"Entities in the question map to the following database values:\n",
|
||||
"{entities_list}\n",
|
||||
"Question: {question}\n",
|
||||
"Cypher query:\"\"\" # noqa: E501\n",
|
||||
"Cypher query:\"\"\"\n",
|
||||
"\n",
|
||||
"cypher_prompt = ChatPromptTemplate.from_messages(\n",
|
||||
" [\n",
|
||||
@@ -377,7 +377,7 @@
|
||||
"response_template = \"\"\"Based on the the question, Cypher query, and Cypher response, write a natural language response:\n",
|
||||
"Question: {question}\n",
|
||||
"Cypher query: {query}\n",
|
||||
"Cypher Response: {response}\"\"\" # noqa: E501\n",
|
||||
"Cypher Response: {response}\"\"\"\n",
|
||||
"\n",
|
||||
"response_prompt = ChatPromptTemplate.from_messages(\n",
|
||||
" [\n",
|
||||
|
@@ -503,7 +503,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"chain = prompt | llm_with_tools | parser | tool # noqa\n",
|
||||
"chain = prompt | llm_with_tools | parser | tool\n",
|
||||
"chain.invoke({\"question\": \"What's the correlation between age and fare\"})"
|
||||
]
|
||||
},
|
||||
|
@@ -262,7 +262,7 @@
|
||||
" return tables\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"table_chain = category_chain | get_tables # noqa\n",
|
||||
"table_chain = category_chain | get_tables\n",
|
||||
"table_chain.invoke({\"input\": \"What are all the genres of Alanis Morisette songs\"})"
|
||||
]
|
||||
},
|
||||
|
@@ -670,7 +670,7 @@
|
||||
" \"type\": \"image_url\",\n",
|
||||
" \"image_url\": {\n",
|
||||
" # langchain logo\n",
|
||||
" \"url\": f\"data:image/png;base64,{img_base64}\", # noqa: E501\n",
|
||||
" \"url\": f\"data:image/png;base64,{img_base64}\",\n",
|
||||
" },\n",
|
||||
" },\n",
|
||||
" {\"type\": \"text\", \"text\": \"What is this logo for?\"},\n",
|
||||
|
@@ -95,7 +95,7 @@
|
||||
" \"\"\"\n",
|
||||
" self.path = path\n",
|
||||
" self._message_line_regex = re.compile(\n",
|
||||
" r\"(.+?) — (\\w{3,9} \\d{1,2}(?:st|nd|rd|th)?(?:, \\d{4})? \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\", # noqa\n",
|
||||
" r\"(.+?) — (\\w{3,9} \\d{1,2}(?:st|nd|rd|th)?(?:, \\d{4})? \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\",\n",
|
||||
" flags=re.DOTALL,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
@@ -120,7 +120,7 @@
|
||||
" current_content = []\n",
|
||||
" for line in lines:\n",
|
||||
" if re.match(\n",
|
||||
" r\".+? — (\\d{2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\", # noqa\n",
|
||||
" r\".+? — (\\d{2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\",\n",
|
||||
" line,\n",
|
||||
" ):\n",
|
||||
" if current_sender and current_content:\n",
|
||||
|
@@ -94,7 +94,7 @@
|
||||
" \"\"\"\n",
|
||||
" self.path = path\n",
|
||||
" self._message_line_regex = re.compile(\n",
|
||||
" r\"(?P<sender>.+?) (?P<timestamp>\\d{4}/\\d{2}/\\d{2} \\d{1,2}:\\d{2} (?:AM|PM))\", # noqa\n",
|
||||
" r\"(?P<sender>.+?) (?P<timestamp>\\d{4}/\\d{2}/\\d{2} \\d{1,2}:\\d{2} (?:AM|PM))\",\n",
|
||||
" # flags=re.DOTALL,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
|
@@ -3,7 +3,7 @@ class MyClass:
|
||||
self.name = name
|
||||
|
||||
def greet(self):
|
||||
print(f"Hello, {self.name}!") # noqa: T201
|
||||
print(f"Hello, {self.name}!")
|
||||
|
||||
|
||||
def main():
|
||||
|
@@ -389,7 +389,7 @@ class ArxivAPIWrapper(BaseModel):
|
||||
|
||||
Returns:
|
||||
List of ArxivPaper objects.
|
||||
""" # noqa: E501
|
||||
"""
|
||||
|
||||
def cut_authors(authors: list) -> list[str]:
|
||||
if len(authors) > 3:
|
||||
|
@@ -186,7 +186,7 @@ def replace_imports(file):
|
||||
data = code_block_re.sub(replacer, data)
|
||||
|
||||
# if all_imports:
|
||||
# print(f"Adding {len(all_imports)} links for imports in {file}") # noqa: T201
|
||||
# print(f"Adding {len(all_imports)} links for imports in {file}")
|
||||
with open(file, "w") as f:
|
||||
f.write(data)
|
||||
return all_imports
|
||||
|
@@ -116,7 +116,7 @@ Each LLM integration can optionally provide native implementations for async, st
|
||||
|
||||
{table}
|
||||
|
||||
""" # noqa: E501
|
||||
"""
|
||||
|
||||
CHAT_MODEL_TEMPLATE = """\
|
||||
---
|
||||
@@ -133,7 +133,7 @@ The following table shows all the chat models that support one or more advanced
|
||||
|
||||
{table}
|
||||
|
||||
""" # noqa: E501
|
||||
"""
|
||||
|
||||
|
||||
def get_llm_table():
|
||||
|
Reference in New Issue
Block a user