View Source Store (fnord v0.4.11)

This module provides the functionality for storing and retrieving embeddings and metadata for files.

Summary

Functions

Permanently deletes the specified file from the store. Note that this is only exposed for the sake of testing.

Permanently delete any files that are indexed but no longer exist on disk.

Permanently deletes the specified project's index directory and all its contents.

Get the metadata, summary, and embeddings for the specified file. Returns {:ok, info} if the file exists, or {:error, :not_found} if it does not.

Get the embeddings for the specified file. Returns {:ok, embeddings} if the file exists, or {:error, :not_found} if it does not. Note that if the input file was greater than 8192 tokens, the embeddings will be split into multiple chunks.

Get the hash for the specified file. Returns {:ok, hash} if the file exists, or {:error, :not_found} if it does not.

Get the summary for the specified file. Returns {:ok, summary} if the file exists, or {:error, :not_found} if it does not.

Get the metadata for the specified file. Returns {:ok, data} if the file exists, or {:error, :not_found} if it does not. The structure of the metadata is as follows

List all indexed files in the project. Returns a list of absolute, expanded, file paths.

List all projects in the store. Returns a list of project names.

Create a new Store struct.

Store the metadata, summary, and embeddings for the specified file. If the file already exists in the store, it will be overwritten.

Functions

Link to this function

delete_file(store, file)

View Source

Permanently deletes the specified file from the store. Note that this is only exposed for the sake of testing.

Link to this function

delete_missing_files(store, root, callback \\ fn -> nil end)

View Source

Permanently delete any files that are indexed but no longer exist on disk.

Permanently deletes the specified project's index directory and all its contents.

Get the metadata, summary, and embeddings for the specified file. Returns {:ok, info} if the file exists, or {:error, :not_found} if it does not.

The structure of the returned info is as follows:

%{
  file: "path/to/file.ext",
  hash: "DEADBEEF",
  timestamp: "2021-01-01T00:00:00Z",
  summary: "AI-generated summary of the file",
  embeddings: [
    [0.1, 0.2, 0.3, ...],
    [0.4, 0.5, 0.6, ...],
    ...
  ]
}
Link to this function

get_embeddings(store, file)

View Source

Get the embeddings for the specified file. Returns {:ok, embeddings} if the file exists, or {:error, :not_found} if it does not. Note that if the input file was greater than 8192 tokens, the embeddings will be split into multiple chunks.

Get the hash for the specified file. Returns {:ok, hash} if the file exists, or {:error, :not_found} if it does not.

Link to this function

get_summary(store, file)

View Source

Get the summary for the specified file. Returns {:ok, summary} if the file exists, or {:error, :not_found} if it does not.

Get the metadata for the specified file. Returns {:ok, data} if the file exists, or {:error, :not_found} if it does not. The structure of the metadata is as follows:

%{
  file: "path/to/file.ext",
  hash: "DEADBEEF",
  timestamp: "2021-01-01T00:00:00Z",
  fnord_path: "path/to/store/FEEBDAED"
}

List all indexed files in the project. Returns a list of absolute, expanded, file paths.

List all projects in the store. Returns a list of project names.

Create a new Store struct.

Link to this function

put(store, file, hash, summary, embeddings)

View Source

Store the metadata, summary, and embeddings for the specified file. If the file already exists in the store, it will be overwritten.