|
30 | 30 | LANGCHAIN_VERSION = get_package_version("langchain") |
31 | 31 | EXCEPTION_HANDLING_FAILURE_LOG_MESSAGE = "Exception occurred in langchain instrumentation: While reporting an exception in langchain, another exception occurred. Report this issue to New Relic Support.\n%s" |
32 | 32 | RECORD_EVENTS_FAILURE_LOG_MESSAGE = "Exception occurred in langchain instrumentation: Failed to record LLM events. Report this issue to New Relic Support.\n%s" |
33 | | - |
34 | 33 | VECTORSTORE_CLASSES = { |
| 34 | + "langchain_community.vectorstores.aerospike": "Aerospike", |
35 | 35 | "langchain_community.vectorstores.alibabacloud_opensearch": "AlibabaCloudOpenSearch", |
36 | 36 | "langchain_community.vectorstores.analyticdb": "AnalyticDB", |
37 | 37 | "langchain_community.vectorstores.annoy": "Annoy", |
38 | 38 | "langchain_community.vectorstores.apache_doris": "ApacheDoris", |
| 39 | + "langchain_community.vectorstores.aperturedb": "ApertureDB", |
39 | 40 | "langchain_community.vectorstores.astradb": "AstraDB", |
40 | 41 | "langchain_community.vectorstores.atlas": "AtlasDB", |
41 | 42 | "langchain_community.vectorstores.awadb": "AwaDB", |
| 43 | + "langchain_community.vectorstores.azure_cosmos_db_no_sql": "AzureCosmosDBNoSqlVectorSearch", |
42 | 44 | "langchain_community.vectorstores.azure_cosmos_db": "AzureCosmosDBVectorSearch", |
43 | 45 | "langchain_community.vectorstores.azuresearch": "AzureSearch", |
44 | 46 | "langchain_community.vectorstores.baiduvectordb": "BaiduVectorDB", |
|
72 | 74 | "langchain_community.vectorstores.lancedb": "LanceDB", |
73 | 75 | "langchain_community.vectorstores.lantern": "Lantern", |
74 | 76 | "langchain_community.vectorstores.llm_rails": "LLMRails", |
| 77 | + "langchain_community.vectorstores.manticore_search": "ManticoreSearch", |
75 | 78 | "langchain_community.vectorstores.marqo": "Marqo", |
76 | 79 | "langchain_community.vectorstores.matching_engine": "MatchingEngine", |
77 | 80 | "langchain_community.vectorstores.meilisearch": "Meilisearch", |
|
80 | 83 | "langchain_community.vectorstores.mongodb_atlas": "MongoDBAtlasVectorSearch", |
81 | 84 | "langchain_community.vectorstores.myscale": "MyScale", |
82 | 85 | "langchain_community.vectorstores.neo4j_vector": "Neo4jVector", |
83 | | - "langchain_community.vectorstores.thirdai_neuraldb": "NeuralDBVectorStore", |
| 86 | + "langchain_community.vectorstores.thirdai_neuraldb": ["NeuralDBClientVectorStore", "NeuralDBVectorStore"], |
84 | 87 | "langchain_community.vectorstores.nucliadb": "NucliaDB", |
85 | 88 | "langchain_community.vectorstores.oraclevs": "OracleVS", |
86 | 89 | "langchain_community.vectorstores.opensearch_vector_search": "OpenSearchVectorSearch", |
|
119 | 122 | "langchain_community.vectorstores.weaviate": "Weaviate", |
120 | 123 | "langchain_community.vectorstores.xata": "XataVectorStore", |
121 | 124 | "langchain_community.vectorstores.yellowbrick": "Yellowbrick", |
| 125 | + "langchain_community.vectorstores.zep_cloud": "ZepCloudVectorStore", |
122 | 126 | "langchain_community.vectorstores.zep": "ZepVectorStore", |
123 | 127 | "langchain_community.vectorstores.docarray.hnsw": "DocArrayHnswSearch", |
124 | 128 | "langchain_community.vectorstores.docarray.in_memory": "DocArrayInMemorySearch", |
@@ -871,12 +875,20 @@ def instrument_langchain_chains_base(module): |
871 | 875 |
|
872 | 876 |
|
873 | 877 | def instrument_langchain_vectorstore_similarity_search(module): |
874 | | - vector_class = VECTORSTORE_CLASSES.get(module.__name__) |
875 | | - |
876 | | - if vector_class and hasattr(getattr(module, vector_class, ""), "similarity_search"): |
877 | | - wrap_function_wrapper(module, "%s.similarity_search" % vector_class, wrap_similarity_search) |
878 | | - if vector_class and hasattr(getattr(module, vector_class, ""), "asimilarity_search"): |
879 | | - wrap_function_wrapper(module, "%s.asimilarity_search" % vector_class, wrap_asimilarity_search) |
| 878 | + def _instrument_class(module, vector_class): |
| 879 | + if hasattr(getattr(module, vector_class, ""), "similarity_search"): |
| 880 | + wrap_function_wrapper(module, "%s.similarity_search" % vector_class, wrap_similarity_search) |
| 881 | + if hasattr(getattr(module, vector_class, ""), "asimilarity_search"): |
| 882 | + wrap_function_wrapper(module, "%s.asimilarity_search" % vector_class, wrap_asimilarity_search) |
| 883 | + |
| 884 | + vector_classes = VECTORSTORE_CLASSES.get(module.__name__) |
| 885 | + if vector_classes is None: |
| 886 | + return |
| 887 | + if isinstance(vector_classes, list): |
| 888 | + for vector_class in vector_classes: |
| 889 | + _instrument_class(module, vector_class) |
| 890 | + else: |
| 891 | + _instrument_class(module, vector_classes) |
880 | 892 |
|
881 | 893 |
|
882 | 894 | def instrument_langchain_core_tools(module): |
|
0 commit comments