Skip to content

Commit 2117892

Browse files
committed
remove untested providers
1 parent 8145afc commit 2117892

File tree

1 file changed

+1
-59
lines changed

1 file changed

+1
-59
lines changed

src/shared/retrieval.py

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414

1515
from shared.configuration import BaseConfiguration
1616

17-
## Encoder constructors
18-
1917

18+
## Encoder constructors
2019
def make_text_encoder(model: str) -> Embeddings:
2120
"""Connect to the configured text encoder."""
2221
provider, model = model.split("/", maxsplit=1)
@@ -25,44 +24,11 @@ def make_text_encoder(model: str) -> Embeddings:
2524
from langchain_openai import OpenAIEmbeddings
2625

2726
return OpenAIEmbeddings(model=model)
28-
case "cohere":
29-
from langchain_cohere import CohereEmbeddings
30-
31-
return CohereEmbeddings(model=model) # type: ignore
3227
case _:
3328
raise ValueError(f"Unsupported embedding provider: {provider}")
3429

3530

3631
## Retriever constructors
37-
38-
39-
@contextmanager
40-
def make_elastic_retriever(
41-
configuration: BaseConfiguration, embedding_model: Embeddings
42-
) -> Generator[VectorStoreRetriever, None, None]:
43-
"""Configure this agent to connect to a specific elastic index."""
44-
from langchain_elasticsearch import ElasticsearchStore
45-
46-
connection_options = {}
47-
if configuration.retriever_provider == "elastic-local":
48-
connection_options = {
49-
"es_user": os.environ["ELASTICSEARCH_USER"],
50-
"es_password": os.environ["ELASTICSEARCH_PASSWORD"],
51-
}
52-
53-
else:
54-
connection_options = {"es_api_key": os.environ["ELASTICSEARCH_API_KEY"]}
55-
56-
vstore = ElasticsearchStore(
57-
**connection_options, # type: ignore
58-
es_url=os.environ["ELASTICSEARCH_URL"],
59-
index_name="langchain_index",
60-
embedding=embedding_model,
61-
)
62-
63-
yield vstore.as_retriever(search_kwargs=configuration.search_kwargs)
64-
65-
6632
@contextmanager
6733
def make_pinecone_retriever(
6834
configuration: BaseConfiguration, embedding_model: Embeddings
@@ -75,22 +41,6 @@ def make_pinecone_retriever(
7541
)
7642
yield vstore.as_retriever(search_kwargs=configuration.search_kwargs)
7743

78-
79-
@contextmanager
80-
def make_mongodb_retriever(
81-
configuration: BaseConfiguration, embedding_model: Embeddings
82-
) -> Generator[VectorStoreRetriever, None, None]:
83-
"""Configure this agent to connect to a specific MongoDB Atlas index & namespaces."""
84-
from langchain_mongodb.vectorstores import MongoDBAtlasVectorSearch
85-
86-
vstore = MongoDBAtlasVectorSearch.from_connection_string(
87-
os.environ["MONGODB_URI"],
88-
namespace="langgraph_retrieval_agent.default",
89-
embedding=embedding_model,
90-
)
91-
yield vstore.as_retriever(search_kwargs=configuration.search_kwargs)
92-
93-
9444
@contextmanager
9545
def make_retriever(
9646
config: RunnableConfig,
@@ -99,18 +49,10 @@ def make_retriever(
9949
configuration = BaseConfiguration.from_runnable_config(config)
10050
embedding_model = make_text_encoder(configuration.embedding_model)
10151
match configuration.retriever_provider:
102-
case "elastic" | "elastic-local":
103-
with make_elastic_retriever(configuration, embedding_model) as retriever:
104-
yield retriever
105-
10652
case "pinecone":
10753
with make_pinecone_retriever(configuration, embedding_model) as retriever:
10854
yield retriever
10955

110-
case "mongodb":
111-
with make_mongodb_retriever(configuration, embedding_model) as retriever:
112-
yield retriever
113-
11456
case _:
11557
raise ValueError(
11658
"Unrecognized retriever_provider in configuration. "

0 commit comments

Comments
 (0)