mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-19 21:33:51 +00:00
Fix a few typos and wrapped f-strings (#128)
Fix a few typos and wrapped f-strings
This commit is contained in:
parent
8a5ec894e7
commit
2910f50a3c
@ -32,11 +32,7 @@ class Wikipedia(Docstore):
|
|||||||
page_content = wikipedia.page(search).content
|
page_content = wikipedia.page(search).content
|
||||||
result: Union[str, Document] = Document(page_content=page_content)
|
result: Union[str, Document] = Document(page_content=page_content)
|
||||||
except wikipedia.PageError:
|
except wikipedia.PageError:
|
||||||
result = (
|
result = f"Could not find [{search}]. Similar: {wikipedia.search(search)}"
|
||||||
f"Could not find [{search}]. " f"Similar: {wikipedia.search(search)}"
|
|
||||||
)
|
|
||||||
except wikipedia.DisambiguationError:
|
except wikipedia.DisambiguationError:
|
||||||
result = (
|
result = f"Could not find [{search}]. Similar: {wikipedia.search(search)}"
|
||||||
f"Could not find [{search}]. " f"Similar: {wikipedia.search(search)}"
|
|
||||||
)
|
|
||||||
return result
|
return result
|
||||||
|
@ -55,7 +55,7 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
import elasticsearch
|
import elasticsearch
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Could not import elasticsearch python packge. "
|
"Could not import elasticsearch python package. "
|
||||||
"Please install it with `pip install elasticearch`."
|
"Please install it with `pip install elasticearch`."
|
||||||
)
|
)
|
||||||
self.embedding_function = embedding_function
|
self.embedding_function = embedding_function
|
||||||
@ -64,7 +64,7 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
es_client = elasticsearch.Elasticsearch(elasticsearch_url) # noqa
|
es_client = elasticsearch.Elasticsearch(elasticsearch_url) # noqa
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Your elasticsearch client string is misformatted. " f"Got error: {e} "
|
f"Your elasticsearch client string is misformatted. Got error: {e} "
|
||||||
)
|
)
|
||||||
self.client = es_client
|
self.client = es_client
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
) -> "ElasticVectorSearch":
|
) -> "ElasticVectorSearch":
|
||||||
"""Construct ElasticVectorSearch wrapper from raw documents.
|
"""Construct ElasticVectorSearch wrapper from raw documents.
|
||||||
|
|
||||||
This is a user friendly interface that:
|
This is a user-friendly interface that:
|
||||||
1. Embeds documents.
|
1. Embeds documents.
|
||||||
2. Creates a new index for the embeddings in the Elasticsearch instance.
|
2. Creates a new index for the embeddings in the Elasticsearch instance.
|
||||||
3. Adds the documents to the newly created Elasticsearch index.
|
3. Adds the documents to the newly created Elasticsearch index.
|
||||||
@ -125,7 +125,7 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
from elasticsearch.helpers import bulk
|
from elasticsearch.helpers import bulk
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Could not import elasticsearch python packge. "
|
"Could not import elasticsearch python package. "
|
||||||
"Please install it with `pip install elasticearch`."
|
"Please install it with `pip install elasticearch`."
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user