Skip to content

Auto generate vectorstore collection on application startup #50

@gregogalante

Description

@gregogalante

During installation, I had problems as I expected the collection in the vectorstore to be created automatically.

I would like to propose inserting the auto-generation of the vectorstore in an after_initialize.

Is this a valid solution in your opinion? I can do a PR if you think it is a good solution.

Below is a Proof of Concept of the solution:

module MyRailsApplication
  class Application < Rails::Application
    # ....
    # Run vectorsearch initialization after application is loaded.
    config.after_initialize do
      provider = LangchainrbRails.config.vectorsearch
      default_schema = provider.get_default_schema
      provider.create_default_schema if !default_schema ||  default_schema.dig('status') != 'ok'
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions