mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-29 18:08:36 +00:00
Harrison/fix lint (#138)
This commit is contained in:
parent
76cecf8165
commit
9f223e6ccc
@ -59,7 +59,7 @@ class MapReduceChain(Chain, BaseModel):
|
|||||||
|
|
||||||
def _call(self, inputs: Dict[str, str]) -> Dict[str, str]:
|
def _call(self, inputs: Dict[str, str]) -> Dict[str, str]:
|
||||||
# Split the larger text into smaller chunks.
|
# Split the larger text into smaller chunks.
|
||||||
docs = self.text_splitter.split_text(inputs[self.input_key],)
|
docs = self.text_splitter.split_text(inputs[self.input_key])
|
||||||
# Now that we have the chunks, we send them to the LLM and track results.
|
# Now that we have the chunks, we send them to the LLM and track results.
|
||||||
# This is the "map" part.
|
# This is the "map" part.
|
||||||
summaries = []
|
summaries = []
|
||||||
|
@ -28,8 +28,7 @@ class Crawler:
|
|||||||
"Could not import playwright python package. "
|
"Could not import playwright python package. "
|
||||||
"Please it install it with `pip install playwright`."
|
"Please it install it with `pip install playwright`."
|
||||||
)
|
)
|
||||||
self.browser = sync_playwright().start().chromium.launch(headless=False,)
|
self.browser = sync_playwright().start().chromium.launch(headless=False)
|
||||||
|
|
||||||
self.page = self.browser.new_page()
|
self.page = self.browser.new_page()
|
||||||
self.page.set_viewport_size({"width": 1280, "height": 1080})
|
self.page.set_viewport_size({"width": 1280, "height": 1080})
|
||||||
|
|
||||||
|
@ -109,4 +109,4 @@ Action 3: Finish[yes]""",
|
|||||||
]
|
]
|
||||||
SUFFIX = """\n\nQuestion: {input}"""
|
SUFFIX = """\n\nQuestion: {input}"""
|
||||||
|
|
||||||
PROMPT = Prompt.from_examples(EXAMPLES, SUFFIX, ["input"],)
|
PROMPT = Prompt.from_examples(EXAMPLES, SUFFIX, ["input"])
|
||||||
|
@ -38,4 +38,4 @@ Intermediate Answer: New Zealand.
|
|||||||
So the final answer is: No
|
So the final answer is: No
|
||||||
|
|
||||||
Question: {input}"""
|
Question: {input}"""
|
||||||
PROMPT = Prompt(input_variables=["input"], template=_DEFAULT_TEMPLATE,)
|
PROMPT = Prompt(input_variables=["input"], template=_DEFAULT_TEMPLATE)
|
||||||
|
@ -15,5 +15,5 @@ Only use the following tables:
|
|||||||
|
|
||||||
Question: {input}"""
|
Question: {input}"""
|
||||||
PROMPT = Prompt(
|
PROMPT = Prompt(
|
||||||
input_variables=["input", "table_info", "dialect"], template=_DEFAULT_TEMPLATE,
|
input_variables=["input", "table_info", "dialect"], template=_DEFAULT_TEMPLATE
|
||||||
)
|
)
|
||||||
|
@ -121,7 +121,7 @@ class AI21(BaseModel, LLM):
|
|||||||
response = requests.post(
|
response = requests.post(
|
||||||
url=f"https://api.ai21.com/studio/v1/{self.model}/complete",
|
url=f"https://api.ai21.com/studio/v1/{self.model}/complete",
|
||||||
headers={"Authorization": f"Bearer {self.ai21_api_key}"},
|
headers={"Authorization": f"Bearer {self.ai21_api_key}"},
|
||||||
json={"prompt": prompt, "stopSequences": stop, **self._default_params,},
|
json={"prompt": prompt, "stopSequences": stop, **self._default_params},
|
||||||
)
|
)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
optional_detail = response.json().get("error")
|
optional_detail = response.json().get("error")
|
||||||
|
@ -45,7 +45,7 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, elasticsearch_url: str, index_name: str, embedding_function: Callable,
|
self, elasticsearch_url: str, index_name: str, embedding_function: Callable
|
||||||
):
|
):
|
||||||
"""Initialize with necessary components."""
|
"""Initialize with necessary components."""
|
||||||
try:
|
try:
|
||||||
|
@ -6,7 +6,7 @@ def test_manifest_wrapper() -> None:
|
|||||||
"""Test manifest wrapper."""
|
"""Test manifest wrapper."""
|
||||||
from manifest import Manifest
|
from manifest import Manifest
|
||||||
|
|
||||||
manifest = Manifest(client_name="openai",)
|
manifest = Manifest(client_name="openai")
|
||||||
llm = ManifestWrapper(client=manifest, llm_kwargs={"temperature": 0})
|
llm = ManifestWrapper(client=manifest, llm_kwargs={"temperature": 0})
|
||||||
output = llm("The capital of New York is:")
|
output = llm("The capital of New York is:")
|
||||||
assert output == "Albany"
|
assert output == "Albany"
|
||||||
|
Loading…
Reference in New Issue
Block a user