Skip to content

feat!: return full response structs from embed, batchEmbed and rerank - #4

Merged
ftsartek merged 1 commit into
mainfrom
feat/interface-improvement
Jul 21, 2026
Merged

ftsartek merged 1 commit into
mainfrom
feat/interface-improvement

Conversation

@ftsartek

Copy link
Copy Markdown
Collaborator
  • embed() and batchEmbed() return EmbeddingResponse; vectors come from output() (one per input, so output()[0] for embed()) and token usage from usage(), which was previously unrecoverable for embedding calls
  • rerank() returns RerankResponse; sorted results via output(), usage via usage()
  • EmbeddingResponse::output() validates its entries: float vectors sorted by index, throwing ResponseException on encoded strings or empty data, with the raw entries still available on the data property
  • drop the private floatEmbedding() helper this makes redundant
  • update README examples, the response-helpers section and tests, with new coverage for usage() on embed/batch/rerank and output() error cases at the struct level
  • add 1.2.0 CHANGELOG entries matching sthai-py

Ports sthai-py 1.2.0 (commits a8fa6ce and 61153d5).

- embed() and batchEmbed() return EmbeddingResponse; vectors come from
  output() (one per input, so output()[0] for embed()) and token usage
  from usage(), which was previously unrecoverable for embedding calls
- rerank() returns RerankResponse; sorted results via output(), usage
  via usage()
- EmbeddingResponse::output() validates its entries: float vectors
  sorted by index, throwing ResponseException on encoded strings or
  empty data, with the raw entries still available on the data property
- drop the private floatEmbedding() helper this makes redundant
- update README examples, the response-helpers section and tests, with
  new coverage for usage() on embed/batch/rerank and output() error
  cases at the struct level
- add 1.2.0 CHANGELOG entries matching sthai-py

Ports sthai-py 1.2.0 (commits a8fa6ce and 61153d5).
@ftsartek
ftsartek merged commit 15cc059 into main Jul 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant