Harrison/fix lint (#138)

This commit is contained in:
Harrison Chase 2022-11-14 08:55:59 -08:00 committed by GitHub
parent 76cecf8165
commit 9f223e6ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 8 additions and 9 deletions

View File

@ -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 = []

View File

@ -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})

View File

@ -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"])

View File

@ -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)

View File

@ -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
) )

View File

@ -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")

View File

@ -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:

View File

@ -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"