codenib.index
¶
Index-related components: sparse, dense, and regex.
Modules:
| Name | Description |
|---|---|
embedding |
Embedding module for CodeNib. |
incremental |
Incremental vector-indexing layer for CodeNib. |
regex_idx |
|
rerank |
Cross-encoder rerankers (pairwise (query, doc) → relevance score). |
sparse_idx |
Sparse indexing module for CodeNib. |
trigram |
Trigram-based search backends. |
Classes:
| Name | Description |
|---|---|
CodeVectorStore |
Vector store for code embeddings using FAISS and sentence-transformers. |
RegexNodeIndex |
In-memory regex-based index for CodeGraph nodes. |
BM25CodeIndexer |
A class that builds a BM25 index from CodeGraph nodes and provides |
Functions:
| Name | Description |
|---|---|
create_code_vector_store |
Factory function to create a CodeVectorStore. |
CodeVectorStore
¶
CodeVectorStore(
embedding_model: str = "text-embedding-ada-002",
embedding_provider: str = "openai",
dimension: int = 1536,
index_type: str = "flat",
index_metric: str = "ip",
ivf_nlist: int = 100,
ivf_nprobe: int = 8,
store_path: str | None = None,
profiler: Profiler | None = None,
embedding: Any | None = None,
artifact_metadata: dict[str, Any] | None = None,
**embedding_kwargs
)
Vector store for code embeddings using FAISS and sentence-transformers. Provides semantic search capabilities over code chunks.
Supports hierarchical indexing: - L0: File-level skeletons - L2: Function/method-level chunks for fine-grained retrieval (default)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embedding_model
|
str
|
Name of the embedding model to use |
'text-embedding-ada-002'
|
embedding_provider
|
str
|
Provider for embeddings ("openai" or "huggingface") |
'openai'
|
dimension
|
int
|
Dimension of the embedding vectors |
1536
|
index_type
|
str
|
FAISS index type — "flat" (exact brute force, default) or "ivf" (IVF inverted-file; approximate, faster at scale). IVF indices are trained lazily on the first batch of vectors. |
'flat'
|
index_metric
|
str
|
Distance metric ("ip" for inner product, "l2" for L2 distance) |
'ip'
|
ivf_nlist
|
int
|
IVF only — number of Voronoi cells (coarse centroids). On
small corpora it is clamped down to the training-set size, since
FAISS k-means needs at least |
100
|
ivf_nprobe
|
int
|
IVF only — cells probed per query; the recall/latency
knob. Clamped to the effective |
8
|
store_path
|
str | None
|
Path to store/load the vector store |
None
|
profiler
|
Profiler | None
|
Optional profiler instance to capture detailed timings |
None
|
embedding
|
Any | None
|
A pre-built embedding wrapper to reuse. When several stores share one model (e.g. one per repo), pass the same instance so the model is loaded onto the GPU only once. |
None
|
artifact_metadata
|
dict[str, Any] | None
|
Optional immutable source/build identity persisted with the top-level configuration. |
None
|
**embedding_kwargs
|
Additional arguments for embedding model |
{}
|
Methods:
| Name | Description |
|---|---|
reuse_query_embedding |
Reuse one query vector within a composed request, then discard it. |
clear_query_cache |
Clear the single-query embedding reused by consecutive search stages. |
swap_index |
Hot-swap the FAISS index without reloading the embedding model. |
close |
Release embeddings and FAISS resources to free memory. |
add_code_chunks |
Add code chunks to the vector store. |
add_nodes_with_content |
Add NodeInfo objects (with content) to the vector store. |
search |
Search for similar code chunks using semantic similarity. |
search_with_content |
Search and return results with content included. |
search_within_ids |
Search only within a restricted set of node IDs. |
hierarchical_search |
Note: This method is implemented by Claude and is just for future reference. |
save |
Save the vector store to disk. |
load |
Load the vector store from disk. |
get_stats |
Get statistics about the vector store. |
get_embeddings_by_content_hash |
Extract raw embedding vectors from the FAISS index, keyed by content hash. |
rebuild_from_embeddings |
Clear level and rebuild its FAISS index from pre-computed embeddings. |
delta_update |
Patch a flat FAISS index in place when the change set is small. |
clear |
Clear data from the vector store. |
Attributes:
| Name | Type | Description |
|---|---|---|
closed |
bool
|
Whether every resource owned by this store has been released. |
Source code in codenib/index/embedding/vector_store.py
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | |
reuse_query_embedding
¶
Reuse one query vector within a composed request, then discard it.
Source code in codenib/index/embedding/vector_store.py
clear_query_cache
¶
Clear the single-query embedding reused by consecutive search stages.
swap_index
¶
swap_index(
path: str, *, native_index_authorization: NativeIndexAuthorization | None = None
) -> None
Hot-swap the FAISS index without reloading the embedding model.
The replacement is fully loaded and validated before the current L0/L2 state is released. The embedding model is left intact so the caller can reuse the same model across many instances.
Source code in codenib/index/embedding/vector_store.py
close
¶
Release embeddings and FAISS resources to free memory.
Source code in codenib/index/embedding/vector_store.py
add_code_chunks
¶
Add code chunks to the vector store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code_chunks
|
list[dict[str, Any]]
|
List of code chunk dictionaries with content and metadata |
required |
level
|
Level
|
Index level to add chunks to ("l0" for file skeletons, "l2" for functions/methods) |
'l2'
|
Source code in codenib/index/embedding/vector_store.py
add_nodes_with_content
¶
add_nodes_with_content(nodes: list[NodeInfo], level: Level = 'l2') -> None
Add NodeInfo objects (with content) to the vector store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes
|
list[NodeInfo]
|
List of NodeInfo objects |
required |
level
|
Level
|
Index level to add nodes to ("l0" or "l2") |
'l2'
|
Source code in codenib/index/embedding/vector_store.py
search
¶
search(
query: str,
top_k: int = 10,
score_threshold: float | None = None,
level: Level = "l2",
mask_node_ids: set[str] | None = None,
) -> list[NodeInfo]
Search for similar code chunks using semantic similarity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query text |
required |
top_k
|
int
|
Number of top results to return |
10
|
score_threshold
|
float | None
|
Minimum similarity score threshold |
None
|
level
|
Level
|
Index level to search ("l0" for file skeletons, "l2" for functions/methods) |
'l2'
|
mask_node_ids
|
set[str] | None
|
Optional set of CodeChunk.node_id values to filter results. |
None
|
Returns:
| Type | Description |
|---|---|
list[NodeInfo]
|
List of NodeInfo objects with scores populated |
Source code in codenib/index/embedding/vector_store.py
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 | |
search_with_content
¶
search_with_content(
query: str,
top_k: int = 10,
score_threshold: float | None = None,
level: Level = "l2",
mask_node_ids: set[str] | None = None,
) -> list[NodeInfo]
Search and return results with content included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query text |
required |
top_k
|
int
|
Number of top results to return |
10
|
score_threshold
|
float | None
|
Minimum similarity score threshold |
None
|
level
|
Level
|
Index level to search ("l0" for file skeletons, "l2" for functions/methods) |
'l2'
|
mask_node_ids
|
set[str] | None
|
Optional set of CodeChunk.node_id values to filter results. |
None
|
Returns:
| Type | Description |
|---|---|
list[NodeInfo]
|
List of NodeInfo objects with content populated |
Source code in codenib/index/embedding/vector_store.py
1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 | |
search_within_ids
¶
search_within_ids(
query: str, mask_node_ids: set[str], top_k: int = 10, level: Level = "l2"
) -> list[NodeInfo]
Search only within a restricted set of node IDs.
Instead of searching the full FAISS index globally and filtering afterwards, this method restricts the search space before computing similarity. It reconstructs stored vectors for matching documents and computes similarity against the query embedding directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query text. |
required |
mask_node_ids
|
set[str]
|
Set of node_id / node_name values to restrict search to. |
required |
top_k
|
int
|
Number of top results to return. |
10
|
level
|
Level
|
Index level to search. |
'l2'
|
Returns:
| Type | Description |
|---|---|
list[NodeInfo]
|
List of NodeInfo objects sorted by similarity score. |
Source code in codenib/index/embedding/vector_store.py
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 | |
hierarchical_search
¶
hierarchical_search(
query: str,
l0_top_k: int = 5,
l2_top_k: int = 10,
l0_score_threshold: float | None = None,
l2_score_threshold: float | None = None,
filter_l2_by_l0: bool = True,
) -> dict[str, list[NodeInfo]]
Note: This method is implemented by Claude and is just for future reference. Perform hierarchical search: first L0 (files), then L2 (functions).
This implements a coarse-to-fine retrieval strategy: 1. Search L0 to find relevant files based on their skeletons 2. Search L2 for specific functions/methods 3. Optionally filter L2 results to only include those from L0 files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query text |
required |
l0_top_k
|
int
|
Number of top L0 results (files) |
5
|
l2_top_k
|
int
|
Number of top L2 results (functions/methods) |
10
|
l0_score_threshold
|
float | None
|
Score threshold for L0 results |
None
|
l2_score_threshold
|
float | None
|
Score threshold for L2 results |
None
|
filter_l2_by_l0
|
bool
|
If True, only return L2 results from files found in L0 |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, list[NodeInfo]]
|
Dict with 'l0' and 'l2' keys containing search results |
Source code in codenib/index/embedding/vector_store.py
save
¶
Save the vector store to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | None
|
Path to save the store (uses self.store_path if not provided) |
None
|
Source code in codenib/index/embedding/vector_store.py
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 | |
load
¶
load(
path: str | None = None,
*,
native_index_authorization: NativeIndexAuthorization | None = None
) -> None
Load the vector store from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | None
|
Path to load the store from (uses self.store_path if not provided) |
None
|
native_index_authorization
|
NativeIndexAuthorization | None
|
Process-local authorization bound to the exact captured tree and semantic view contract. Artifact fields cannot provide this capability. |
None
|
Source code in codenib/index/embedding/vector_store.py
2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 | |
get_stats
¶
Get statistics about the vector store.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with store statistics |
Source code in codenib/index/embedding/vector_store.py
get_embeddings_by_content_hash
¶
Extract raw embedding vectors from the FAISS index, keyed by content hash.
This is used to seed the EmbeddingsCache after a full build so that
the first incremental update achieves ~100% cache hit rate for unchanged
chunks.
Each document's content is MD5-hashed to produce the key. If the
document metadata already contains a content_hash field it is used
directly; otherwise the hash is computed on the fly.
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dict mapping content_hash → np.ndarray (float32 vectors). |
Source code in codenib/index/embedding/vector_store.py
rebuild_from_embeddings
¶
Clear level and rebuild its FAISS index from pre-computed embeddings.
Used by the incremental update path: unchanged chunks contribute their cached vectors, so only genuinely new/modified chunks require model inference. No embedding model calls are made by this method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
documents
|
list
|
Document-like objects with |
required |
embeddings
|
list[ndarray]
|
Corresponding embedding vectors as |
required |
level
|
Level
|
Which index level to rebuild ( |
'l2'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If documents and embeddings have different lengths. |
Source code in codenib/index/embedding/vector_store.py
delta_update
¶
delta_update(
all_documents: list,
all_embeddings: list[ndarray],
changed_content_hashes: set[str],
level: Level = "l2",
threshold: float = 0.1,
) -> None
Patch a flat FAISS index in place when the change set is small.
When the fraction of changed chunks is below threshold, this uses
IndexFlat.remove_ids + add to modify only the affected rows,
keeping unchanged vectors and their aligned documents untouched. IVF
indexes are rebuilt because removing their implicit IDs does not
compact the remaining labels to match the document array. If the
change ratio exceeds the threshold (or the index is empty), this also
falls back to :meth:rebuild_from_embeddings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_documents
|
list
|
The complete desired set of documents for level
after the update. Must carry |
required |
all_embeddings
|
list[ndarray]
|
Corresponding embedding vectors, aligned with all_documents. |
required |
changed_content_hashes
|
set[str]
|
Content hashes of chunks that were added, removed, or modified in this update cycle. Used both to decide between delta/rebuild and to identify stale rows. |
required |
level
|
Level
|
Which index level to update. |
'l2'
|
threshold
|
float
|
Maximum change ratio (changed/total) for the delta path; above this a full rebuild is performed. |
0.1
|
Source code in codenib/index/embedding/vector_store.py
2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 | |
clear
¶
Clear data from the vector store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
Level | None
|
If specified, only clear that level ("l0" or "l2"). If None, clear both levels. |
None
|
Source code in codenib/index/embedding/vector_store.py
RegexNodeIndex
¶
RegexNodeIndex(code_graph: CodeGraph)
In-memory regex-based index for CodeGraph nodes. Supports regex pattern matching on node content with glob filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code_graph
|
CodeGraph
|
CodeGraph instance containing nodes to index |
required |
Methods:
| Name | Description |
|---|---|
search |
Search for pattern in node content (grep-like functionality). |
Source code in codenib/index/regex_idx/regex_idx.py
search
¶
search(
pattern: str,
file_glob: str | None = None,
node_type: str | None = None,
case_sensitive: bool = False,
use_regex: bool = True,
top_k: int | None = None,
) -> list[NodeInfo]
Search for pattern in node content (grep-like functionality).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Search pattern (regex or plain string) |
required |
file_glob
|
str | None
|
Optional glob to filter by file path (e.g., '.py', '*/calc.py') |
None
|
node_type
|
str | None
|
Optional node type to filter (e.g., 'function', 'class', 'file') |
None
|
case_sensitive
|
bool
|
Whether search is case-sensitive (default: False) |
False
|
use_regex
|
bool
|
Whether to use regex (default: True) or plain string matching |
True
|
top_k
|
int | None
|
Optional result limit. Regex searches stop as soon as it is met. |
None
|
Returns:
| Type | Description |
|---|---|
list[NodeInfo]
|
List of NodeInfo objects matching the pattern |
Examples:
>>> idx.search(r'def\s+\w+', file_glob='*.py') # Find function defs
>>> idx.search('calculator', use_regex=False) # Plain string search
>>> idx.search('class', node_type='file') # Search in file nodes only
Source code in codenib/index/regex_idx/regex_idx.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
BM25CodeIndexer
¶
BM25CodeIndexer(
code_graph=None,
chunks=None,
max_k: int = 15,
language: str = "english",
project_root: str | None = None,
*,
prepare_only: bool = False,
check_cancelled: Callable[[], None] | None = None
)
A class that builds a BM25 index from CodeGraph nodes and provides search functionality with stemming support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code_graph
|
CodeGraph instance containing nodes to index. If provided, the index will be built immediately. |
None
|
|
chunks
|
List of CodeChunk objects to index. If provided, the index will be built immediately. |
None
|
|
max_k
|
int
|
Maximum number of results to return in searches |
15
|
language
|
str
|
Language for stopword removal Default is "english" which works well for processing code tokens as it treats special characters as separators |
'english'
|
project_root
|
str | None
|
Repository root used to resolve relative source paths |
None
|
prepare_only
|
bool
|
Prepare canonical persisted documents without building the serving-time in-memory rank index. |
False
|
check_cancelled
|
Callable[[], None] | None
|
Cooperative stop check for prepare-only chunk builds. |
None
|
Methods:
| Name | Description |
|---|---|
build_index_from_graph |
Build a BM25 index from a CodeGraph. |
build_index_from_chunks |
Build a BM25 index from a list of CodeChunk objects. |
bind_repository_source |
Attach a retained source authority chosen by the runtime caller. |
save_index |
Save the index to a directory. |
load_index |
Load the index from a directory. |
load_index_values |
Load already-decoded BM25 values from an authenticated reader. |
Source code in codenib/index/sparse_idx/bm25_index.py
build_index_from_graph
¶
build_index_from_graph(code_graph: CodeGraph) -> BM25Retriever
Build a BM25 index from a CodeGraph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code_graph
|
CodeGraph
|
CodeGraph instance containing nodes to index |
required |
Source code in codenib/index/sparse_idx/bm25_index.py
build_index_from_chunks
¶
build_index_from_chunks(
chunks: list[CodeChunk], *, project_root: str | None = None
) -> BM25Retriever
Build a BM25 index from a list of CodeChunk objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks
|
list[CodeChunk]
|
List of CodeChunk objects (with node_id, chunk_type, name, file, etc.) |
required |
project_root
|
str | None
|
Repository root used to resolve relative source paths |
None
|
Returns:
| Type | Description |
|---|---|
BM25Retriever
|
BM25Retriever instance |
Source code in codenib/index/sparse_idx/bm25_index.py
bind_repository_source
¶
Attach a retained source authority chosen by the runtime caller.
Source code in codenib/index/sparse_idx/bm25_index.py
save_index
¶
Save the index to a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory_path
|
str
|
Path to save the index to |
required |
Source code in codenib/index/sparse_idx/bm25_index.py
load_index
¶
Load the index from a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory_path
|
str
|
Path to load the index from |
required |
Source code in codenib/index/sparse_idx/bm25_index.py
load_index_values
¶
load_index_values(
documents_data: Iterable[object],
metadata: Mapping[str, Any] | None,
*,
source_mode: str = SOURCE_MODE_LEGACY_DIRECT
) -> None
Load already-decoded BM25 values from an authenticated reader.
Artifact runtimes use this entry point so persisted bytes can be read through a pinned directory authority instead of being reopened by path.
Source code in codenib/index/sparse_idx/bm25_index.py
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 | |
create_code_vector_store
¶
create_code_vector_store(
embedding_model: str = "text-embedding-ada-002",
embedding_provider: str = "openai",
store_path: str | None = None,
**kwargs
) -> CodeVectorStore
Factory function to create a CodeVectorStore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embedding_model
|
str
|
Name of the embedding model |
'text-embedding-ada-002'
|
embedding_provider
|
str
|
Provider for embeddings |
'openai'
|
store_path
|
str | None
|
Path to store/load the vector store |
None
|
**kwargs
|
Additional arguments for CodeVectorStore |
{}
|
Returns:
| Type | Description |
|---|---|
CodeVectorStore
|
CodeVectorStore instance |