superagent icon indicating copy to clipboard operation
superagent copied to clipboard

Do not fetch embeddings on every query to a Document Agent

Open homanp opened this issue 2 years ago • 2 comments

Please check that this issue hasn't been reported before.

  • [X] I searched previous Bug Reports didn't find any similar reports.

Expected Behavior

In order to optimize the the request times we need to store embeddings after it's created the first time.

Current behaviour

Currrently embeddings are created for each query.

Steps to reproduce

Call a DoumentAgent.

Possible solution

No response

Which Operating Systems are you using?

  • [ ] Android
  • [ ] iPhone/iPad
  • [ ] Linux
  • [X] macOS
  • [ ] Windows

Acknowledgements

  • [X] My issue title is concise, descriptive.
  • [X] I have searched the existing issues to make sure this bug has not been reported yet.
  • [X] I am using the latest version of superagent.
  • [X] I have provided enough information for the maintainers to reproduce and diagnose the issue.

homanp avatar Jun 17 '23 18:06 homanp

@homanp ...hmm. Trying to understand this. Are you talking about at a question level or a document level? At a document level, we can do a similarity search based on the question already being embedded when asked.

yusofy avatar Jun 17 '23 18:06 yusofy

@homanp ...hmm. Trying to understand this. Are you talking about at a question level or a document level? At a document level, we can do a similarity search based on the question already being embedded when asked.

I'm specifically thinking about this row: https://github.com/homanp/superagent/blob/main/app/lib/agents/base.py#L258

Every time a request via the API is processed this code is run. Just to fetch the Vectorstore. I'm thinking this should be optimized by making the vectorstore persistant.

homanp avatar Jun 17 '23 19:06 homanp