mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-06 03:27:55 +00:00
remove unnecc variables (#113)
i dont think either of these variables are used?
This commit is contained in:
parent
da445e474d
commit
2179ea3103
@ -18,7 +18,6 @@ class OptimizedPrompt(BaseModel):
|
|||||||
from langchain import DynamicPrompt
|
from langchain import DynamicPrompt
|
||||||
vectorstore = FAISS.from_texts(examples, OpenAIEmbeddings()
|
vectorstore = FAISS.from_texts(examples, OpenAIEmbeddings()
|
||||||
optimized_prompt = OptimizedPrompt(
|
optimized_prompt = OptimizedPrompt(
|
||||||
examples=["Say hi. Hi", "Say ho. Ho"],
|
|
||||||
example_separator="\n\n",
|
example_separator="\n\n",
|
||||||
prefix="",
|
prefix="",
|
||||||
suffix="\n\nSay {foo}"
|
suffix="\n\nSay {foo}"
|
||||||
@ -29,9 +28,6 @@ class OptimizedPrompt(BaseModel):
|
|||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
examples: List[str]
|
|
||||||
"""A list of the examples that the prompt template expects."""
|
|
||||||
|
|
||||||
example_separator: str = "\n\n"
|
example_separator: str = "\n\n"
|
||||||
"""Example separator, e.g. \n\n, for the dynamic prompt creation."""
|
"""Example separator, e.g. \n\n, for the dynamic prompt creation."""
|
||||||
|
|
||||||
@ -162,7 +158,6 @@ class OptimizedPrompt(BaseModel):
|
|||||||
examples, embeddings, **vectorstore_cls_kwargs
|
examples, embeddings, **vectorstore_cls_kwargs
|
||||||
)
|
)
|
||||||
return cls(
|
return cls(
|
||||||
examples=examples,
|
|
||||||
suffix=suffix,
|
suffix=suffix,
|
||||||
input_variables=input_variables,
|
input_variables=input_variables,
|
||||||
example_separator=example_separator,
|
example_separator=example_separator,
|
||||||
|
@ -39,7 +39,6 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
elastic_vector_search = ElasticVectorSearch(
|
elastic_vector_search = ElasticVectorSearch(
|
||||||
"http://localhost:9200",
|
"http://localhost:9200",
|
||||||
"embeddings",
|
"embeddings",
|
||||||
mapping,
|
|
||||||
embedding_function
|
embedding_function
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,7 +48,6 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
self,
|
self,
|
||||||
elasticsearch_url: str,
|
elasticsearch_url: str,
|
||||||
index_name: str,
|
index_name: str,
|
||||||
mapping: Dict,
|
|
||||||
embedding_function: Callable,
|
embedding_function: Callable,
|
||||||
):
|
):
|
||||||
"""Initialize with necessary components."""
|
"""Initialize with necessary components."""
|
||||||
@ -69,7 +67,6 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
"Your elasticsearch client string is misformatted. " f"Got error: {e} "
|
"Your elasticsearch client string is misformatted. " f"Got error: {e} "
|
||||||
)
|
)
|
||||||
self.client = es_client
|
self.client = es_client
|
||||||
self.mapping = mapping
|
|
||||||
|
|
||||||
def similarity_search(self, query: str, k: int = 4) -> List[Document]:
|
def similarity_search(self, query: str, k: int = 4) -> List[Document]:
|
||||||
"""Return docs most similar to query.
|
"""Return docs most similar to query.
|
||||||
@ -155,4 +152,4 @@ class ElasticVectorSearch(VectorStore):
|
|||||||
requests.append(request)
|
requests.append(request)
|
||||||
bulk(client, requests)
|
bulk(client, requests)
|
||||||
client.indices.refresh(index=index_name)
|
client.indices.refresh(index=index_name)
|
||||||
return cls(elasticsearch_url, index_name, mapping, embedding.embed_query)
|
return cls(elasticsearch_url, index_name, embedding.embed_query)
|
||||||
|
Loading…
Reference in New Issue
Block a user