Skip to content

3.0.0

Compare
Choose a tag to compare
@cjcenizal cjcenizal released this 24 Jun 14:10
· 14 commits to main since this release
5c65173

What's changed

Support for Query API v2!

Breaking changes

The package interface is now:

import {
  streamQueryV1,
  ApiV1,
  streamQueryV2,
  ApiV2,
} from "@vectara/stream-query-client";

Requests are now configured with the same objects and fields as described in the Corpus Query docs.

The endpoint prop is renamed to domain.

New features

  • Errors are emitted as regular events to the onStreamEvent handler.
  • Calling streamQueryV2 returns { cancelStream, request, status }. Use cancelStream to cancel the stream. Use request to inspect the underlying API v2 request. Use status to determine the initial HTTP response code sent in response to the request.
  • Added authToken config option to support authenticating with a JWT instead of an API key.
  • Exported API types under ApiV1 and ApiV2 namespaces.
  • New GenerationEndEvent is emitted to signify when the generated response is complete.
  • New UnexpectedEvent surfaces any stream events that were unexpected. This provides future-proofing against stream events that might be added to the API in the future.
  • New RequestErrorEvent (server responds with non-200), GenericErrorEvent (when the buffer logic throws a JS error, which shouldn't happen), and UnexpectedErrorEvent (catch-all for other error cases) surface additional error cases.

Bug fixes

  • Events might be very large, e.g. many or large search results, which causes them to be split across multiple chunks. Original code didn't accommodate for this, and risked a JSON.parse error. The client now buffers these chunks until it detects the completion of the event, at which point it emits the buffered event to the consumer.

Full Changelog: 2.1.0...3.0.0