ankane / neighbor

Nearest neighbor search for Rails
MIT License
590 stars 14 forks source link

Fixture comment in README #27

Closed nhorton closed 1 month ago

nhorton commented 1 month ago

As always - thanks for the great work on this.

I am wrestling with how to incorporate neighbors with our test fixtures. Having a 1000 number vector spelled out in the YAML files seems problematic, and having it hit a 3rd party API every test run to use ERB templating to fill that in is also not ideal. VCR with ERB is my best idea right now.

I am not expecting you to make it seamless here, but if you have any thoughts that you could share here or in the README, that would be awesome.

ankane commented 1 month ago

Hi @nhorton, it should be fine to include vectors in YAML (that's where they'd be stored with VCR as well).

If you just need random data, you can use:

one:
  embedding: <%= Array.new(1000) { rand } %>
nhorton commented 1 month ago

It had not occurred to me that the vector did not need to be good data and that random data work work. That is a great idea - thank you!