Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-de985d11041334568361f7cc095daa97f14f1808d7ce817b3186b1e9b912ac3c.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-b96e3394276a930bfc20b33900bda9ba5bed9d12ba4eaf3849b555f2b11131de.yml
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Methods:

Types:

- <code><a href="./src/resources/documents.ts">Document</a></code>
- <code><a href="./src/resources/documents.ts">DocumentRetrieveResponse</a></code>

Methods:

- <code title="get /documents/get/{document_id}">client.documents.<a href="./src/resources/documents.ts">retrieve</a>(documentId) -> Document</code>
- <code title="get /documents/get/{document_id}">client.documents.<a href="./src/resources/documents.ts">retrieve</a>(documentId) -> DocumentRetrieveResponse</code>
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Core from './core';
import * as Errors from './error';
import * as Uploads from './uploads';
import * as API from './resources/index';
import { Document, Documents } from './resources/documents';
import { DocumentRetrieveResponse, Documents } from './resources/documents';
import { Ingest } from './resources/ingest';
import { Query, QueryRetrieveParams, QueryRetrieveResponse } from './resources/query';

Expand Down Expand Up @@ -176,7 +176,7 @@ export declare namespace Hyperspell {
type QueryRetrieveParams as QueryRetrieveParams,
};

export { Documents as Documents, type Document as Document };
export { Documents as Documents, type DocumentRetrieveResponse as DocumentRetrieveResponse };
}

export { toFile, fileFromPath } from './uploads';
Expand Down
70 changes: 43 additions & 27 deletions src/resources/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@ import * as Core from '../core';

export class Documents extends APIResource {
/**
* Retrieves a document by ID.
* Retrieves a document by ID, including its collection name and sections.
*/
retrieve(documentId: number, options?: Core.RequestOptions): Core.APIPromise<Document> {
retrieve(documentId: number, options?: Core.RequestOptions): Core.APIPromise<DocumentRetrieveResponse> {
return this._client.get(`/documents/get/${documentId}`, options);
}
}

export interface Document {
collection_id: number;
export interface DocumentRetrieveResponse {
id: number | null;

id?: number | null;
collection: string;

created_at?: string | null;
created_at: string | null;

ingested_at?: string | null;
ingested_at: string | null;

metadata?: unknown;
metadata: unknown;

/**
* Along with service, uniquely identifies the source document
*/
resource_id?: string;
resource_id: string;

sections?: Array<Document.Section>;
title: string | null;

sections_count?: number | null;
sections?: Array<
DocumentRetrieveResponse.SectionResult | DocumentRetrieveResponse.SectionResultWithElements
>;

source?:
| 'generic'
Expand All @@ -50,30 +49,47 @@ export interface Document {
| 'google_docs';

status?: 'pending' | 'processing' | 'completed' | 'failed';

title?: string | null;
}

export namespace Document {
export interface Section {
document_id: number;

export namespace DocumentRetrieveResponse {
export interface SectionResult {
id?: number | null;

elements?: Array<Section.Element>;
scores?: SectionResult.Scores;

embedding_e5_large?: Array<number> | null;
text?: string;
}

embedding_ts?: string | null;
export namespace SectionResult {
export interface Scores {
/**
* How relevant the section is based on full text search
*/
full_text_search?: number | null;

/**
* How relevant the section is based on vector search
*/
semantic_search?: number | null;

/**
* The final weighted score of the section
*/
weighted?: number | null;
}
}

export interface SectionResultWithElements {
id?: number | null;

metadata?: unknown;
elements?: Array<SectionResultWithElements.Element>;

scores?: Section.Scores;
scores?: SectionResultWithElements.Scores;

text?: string;
}

export namespace Section {
export namespace SectionResultWithElements {
export interface Element {
text: string;

Expand Down Expand Up @@ -128,5 +144,5 @@ export namespace Document {
}

export declare namespace Documents {
export { type Document as Document };
export { type DocumentRetrieveResponse as DocumentRetrieveResponse };
}
2 changes: 1 addition & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Documents, type Document } from './documents';
export { Documents, type DocumentRetrieveResponse } from './documents';
export { Ingest } from './ingest';
export { Query, type QueryRetrieveResponse, type QueryRetrieveParams } from './query';
39 changes: 29 additions & 10 deletions src/resources/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export namespace QueryRetrieveResponse {

title: string | null;

sections?: Array<Document.Section>;
sections?: Array<Document.SectionResult | Document.SectionResultWithElements>;

source?:
| 'generic'
Expand All @@ -57,25 +57,44 @@ export namespace QueryRetrieveResponse {
}

export namespace Document {
export interface Section {
document_id: number;

export interface SectionResult {
id?: number | null;

elements?: Array<Section.Element>;
scores?: SectionResult.Scores;

text?: string;
}

export namespace SectionResult {
export interface Scores {
/**
* How relevant the section is based on full text search
*/
full_text_search?: number | null;

/**
* How relevant the section is based on vector search
*/
semantic_search?: number | null;

embedding_e5_large?: Array<number> | null;
/**
* The final weighted score of the section
*/
weighted?: number | null;
}
}

embedding_ts?: string | null;
export interface SectionResultWithElements {
id?: number | null;

metadata?: unknown;
elements?: Array<SectionResultWithElements.Element>;

scores?: Section.Scores;
scores?: SectionResultWithElements.Scores;

text?: string;
}

export namespace Section {
export namespace SectionResultWithElements {
export interface Element {
text: string;

Expand Down