function recordVectorSearch({
  request,
  k,
  output,
  agent,
  shim,
  segment,
  transaction,
  pkgVersion,
  err
}) {
  const vectorSearch = new LangChainVectorSearch({
    agent,
    segment,
    transaction,
    query: request,
    k,
    documents: output,
    error: err !== null
  })

  recordEvent({ agent, shim, type: 'LlmVectorSearch', pkgVersion, msg: vectorSearch })

  output.forEach((document, sequence) => {
    const vectorSearchResult = new LangChainVectorSearchResult({
      agent,
      segment,
      metadata: document.metadata,
      pageContent: document.pageContent,
      sequence,
      search_id: vectorSearch.id,
      transaction
    })

    recordEvent({
      agent,
      shim,
      type: 'LlmVectorSearchResult',
      pkgVersion,
      msg: vectorSearchResult
    })
  })

  if (err) {
    agent.errors.add(
      transaction,
      err,
      new LlmErrorMessage({
        response: output,
        cause: err,
        vectorsearch: vectorSearch
      })
    )
  }
}
Generates a LangChainVectorSearch for entire search request.
Also iterates over documents in output and generates a
LangChainVectorSearchResult for each document.

@param {object} params input params
@param {string} params.request vector search query
@param {number} params.k vector search top k
@param {object} params.output vector search documents
@param {Agent} params.agent NR agent instance
@param {Shim} params.shim current shim instance
@param {TraceSegment} params.segment active segment from vector search
@param {string} params.pkgVersion langchain version
@param {Error} params.err if it exists
@param {Transaction} params.transaction active transaction