Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.0.10 #57

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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.9"
".": "0.0.10"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 40
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-96679f6cf67d77d1e9587886a8cdbb6e2a132b9f8abd22c056e479fe3ff89a6f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-e4c301de216e3c01c130dfbf82f7d5272939867cc4b452aa00d6f0e081767bec.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.0.10 (2024-11-15)

Full Changelog: [v0.0.9...v0.0.10](https://github.com/plastic-labs/honcho-node/compare/v0.0.9...v0.0.10)

### Features

* **api:** api update ([#59](https://github.com/plastic-labs/honcho-node/issues/59)) ([aeac0e4](https://github.com/plastic-labs/honcho-node/commit/aeac0e4110048c0860c984b92a2401eb34a13b8a))


### Chores

* rebuild project due to codegen change ([#56](https://github.com/plastic-labs/honcho-node/issues/56)) ([126da8f](https://github.com/plastic-labs/honcho-node/commit/126da8f6c1b627b19a7b4900ad8a84c19da6799d))
* rebuild project due to codegen change ([#58](https://github.com/plastic-labs/honcho-node/issues/58)) ([3e76822](https://github.com/plastic-labs/honcho-node/commit/3e768223717585f365825ced6c88bb33f7cd8ddb))

## 0.0.9 (2024-11-08)

Full Changelog: [v0.0.8...v0.0.9](https://github.com/plastic-labs/honcho-node/compare/v0.0.8...v0.0.9)
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ for (const user of page.items) {

// Convenience methods are provided for manually paginating:
while (page.hasNextPage()) {
page = page.getNextPage();
page = await page.getNextPage();
// ...
}
```
Expand Down Expand Up @@ -316,6 +316,15 @@ TypeScript >= 4.5 is supported.

The following runtimes are supported:

- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher, using `import Honcho from "npm:honcho-ai"`.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
- Nitro v2.6 or greater.

Note that React Native is not supported at this time.

If you are interested in other runtime environments, please open or upvote an issue on GitHub.
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ Methods:
- <code title="post /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/list">client.apps.users.collections.documents.<a href="./src/resources/apps/users/collections/documents.ts">list</a>(appId, userId, collectionId, { ...params }) -> DocumentsPage</code>
- <code title="delete /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}">client.apps.users.collections.documents.<a href="./src/resources/apps/users/collections/documents.ts">delete</a>(appId, userId, collectionId, documentId) -> unknown</code>
- <code title="get /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}">client.apps.users.collections.documents.<a href="./src/resources/apps/users/collections/documents.ts">get</a>(appId, userId, collectionId, documentId) -> Document</code>
- <code title="get /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query">client.apps.users.collections.documents.<a href="./src/resources/apps/users/collections/documents.ts">query</a>(appId, userId, collectionId, { ...params }) -> DocumentQueryResponse</code>
- <code title="post /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query">client.apps.users.collections.documents.<a href="./src/resources/apps/users/collections/documents.ts">query</a>(appId, userId, collectionId, { ...params }) -> DocumentQueryResponse</code>
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "honcho-ai",
"version": "0.0.9",
"version": "0.0.10",
"description": "The official TypeScript library for the Honcho API",
"author": "Honcho <hello@plasticlabs.ai>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -45,7 +45,6 @@
"jest": "^29.4.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
"tsc-multi": "^1.1.0",
"tsconfig-paths": "^4.0.0",
Expand Down
36 changes: 16 additions & 20 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const environments = {
local: 'http://localhost:8000',
};
type Environment = keyof typeof environments;

export interface ClientOptions {
/**
* Defaults to process.env['HONCHO_API_KEY'].
Expand Down Expand Up @@ -180,6 +179,22 @@ export class Honcho extends Core.APIClient {
static fileFromPath = Uploads.fileFromPath;
}

Honcho.Apps = Apps;
export declare namespace Honcho {
export type RequestOptions = Core.RequestOptions;

export import Page = Pagination.Page;
export { type PageParams as PageParams, type PageResponse as PageResponse };

export {
Apps as Apps,
type App as App,
type AppCreateParams as AppCreateParams,
type AppUpdateParams as AppUpdateParams,
};
}

export { toFile, fileFromPath } from './uploads';
export {
HonchoError,
APIError,
Expand All @@ -196,23 +211,4 @@ export {
UnprocessableEntityError,
} from './error';

export import toFile = Uploads.toFile;
export import fileFromPath = Uploads.fileFromPath;

Honcho.Apps = Apps;

export declare namespace Honcho {
export type RequestOptions = Core.RequestOptions;

export import Page = Pagination.Page;
export { type PageParams as PageParams, type PageResponse as PageResponse };

export {
Apps as Apps,
type App as App,
type AppCreateParams as AppCreateParams,
type AppUpdateParams as AppUpdateParams,
};
}

export default Honcho;
23 changes: 1 addition & 22 deletions src/resources/apps/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,35 @@ export class Apps extends APIResource {
users: UsersAPI.Users = new UsersAPI.Users(this._client);

/**
* Create an App
*
* Args: app (schemas.AppCreate): The App object containing any metadata
*
* Returns: schemas.App: Created App object
* Create a new App
*/
create(body: AppCreateParams, options?: Core.RequestOptions): Core.APIPromise<App> {
return this._client.post('/v1/apps', { body, ...options });
}

/**
* Update an App
*
* Args: app_id (str): The ID of the app to update app (schemas.AppUpdate): The App
* object containing any new metadata
*
* Returns: schemas.App: The App object of the updated App
*/
update(appId: string, body: AppUpdateParams, options?: Core.RequestOptions): Core.APIPromise<App> {
return this._client.put(`/v1/apps/${appId}`, { body, ...options });
}

/**
* Get an App by ID
*
* Args: app_id (str): The ID of the app
*
* Returns: schemas.App: App object
*/
get(appId: string, options?: Core.RequestOptions): Core.APIPromise<App> {
return this._client.get(`/v1/apps/${appId}`, options);
}

/**
* Get an App by Name
*
* Args: app_name (str): The name of the app
*
* Returns: schemas.App: App object
*/
getByName(name: string, options?: Core.RequestOptions): Core.APIPromise<App> {
return this._client.get(`/v1/apps/name/${name}`, options);
}

/**
* Get or Create an App
*
* Args: app_name (str): The name of the app
*
* Returns: schemas.App: App object
*/
getOrCreate(name: string, options?: Core.RequestOptions): Core.APIPromise<App> {
return this._client.get(`/v1/apps/get_or_create/${name}`, options);
Expand Down
15 changes: 5 additions & 10 deletions src/resources/apps/users/collections/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Collections extends APIResource {
documents: DocumentsAPI.Documents = new DocumentsAPI.Documents(this._client);

/**
* Create Collection
* Create a new Collection
*/
create(
appId: string,
Expand All @@ -33,7 +33,7 @@ export class Collections extends APIResource {
}

/**
* Update Collection
* Update a Collection's name or metadata
*/
update(
appId: string,
Expand All @@ -50,11 +50,6 @@ export class Collections extends APIResource {

/**
* Get All Collections for a User
*
* Args: app_id (str): The ID of the app representing the client application using
* honcho user_id (str): The User ID representing the user, managed by the user
*
* Returns: list[schemas.Collection]: List of Collection objects
*/
list(
appId: string,
Expand All @@ -72,7 +67,7 @@ export class Collections extends APIResource {
}

/**
* Delete Collection
* Delete a Collection and its documents
*/
delete(
appId: string,
Expand All @@ -84,7 +79,7 @@ export class Collections extends APIResource {
}

/**
* Get Collection By Id
* Get a Collection by ID
*/
get(
appId: string,
Expand All @@ -96,7 +91,7 @@ export class Collections extends APIResource {
}

/**
* Get Collection By Name
* Get a Collection by Name
*/
getByName(
appId: string,
Expand Down
24 changes: 12 additions & 12 deletions src/resources/apps/users/collections/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Page, type PageParams } from '../../../../pagination';

export class Documents extends APIResource {
/**
* Create Document
* Embed text as a vector and create a Document
*/
create(
appId: string,
Expand All @@ -22,7 +22,7 @@ export class Documents extends APIResource {
}

/**
* Update Document
* Update the content and/or the metadata of a Document
*/
update(
appId: string,
Expand All @@ -39,7 +39,7 @@ export class Documents extends APIResource {
}

/**
* Get Documents
* Get all of the Documents in a Collection
*/
list(
appId: string,
Expand All @@ -57,7 +57,7 @@ export class Documents extends APIResource {
}

/**
* Delete Document
* Delete a Document by ID
*/
delete(
appId: string,
Expand All @@ -73,7 +73,7 @@ export class Documents extends APIResource {
}

/**
* Get Document
* Get a document by ID
*/
get(
appId: string,
Expand All @@ -89,19 +89,19 @@ export class Documents extends APIResource {
}

/**
* Query Documents
* Cosine Similarity Search for Documents
*/
query(
appId: string,
userId: string,
collectionId: string,
query: DocumentQueryParams,
body: DocumentQueryParams,
options?: Core.RequestOptions,
): Core.APIPromise<DocumentQueryResponse> {
return this._client.get(`/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`, {
query,
...options,
});
return this._client.post(
`/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`,
{ body, ...options },
);
}
}

Expand Down Expand Up @@ -162,7 +162,7 @@ export interface DocumentListParams extends PageParams {
export interface DocumentQueryParams {
query: string;

filter?: string | null;
filter?: Record<string, unknown> | null;

top_k?: number;
}
Expand Down
8 changes: 0 additions & 8 deletions src/resources/apps/users/metamessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import { type PageParams } from '../../../pagination';
export class Metamessages extends APIResource {
/**
* Paginate through the user metamessages for a user
*
* Args: app_id (str): The ID of the app representing the client application using
* honcho user_id (str): The User ID representing the user, managed by the user
* reverse (bool): Whether to reverse the order of the metamessages
*
* Returns: list[schemas.Message]: List of Message objects
*
* Raises: HTTPException: If the session is not found
*/
list(
appId: string,
Expand Down
23 changes: 2 additions & 21 deletions src/resources/apps/users/sessions/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ import { Page, type PageParams } from '../../../../pagination';
export class Messages extends APIResource {
/**
* Adds a message to a session
*
* Args: app_id (str): The ID of the app representing the client application using
* honcho user_id (str): The User ID representing the user, managed by the user
* session_id (int): The ID of the Session to add the message to message
* (schemas.MessageCreate): The Message object to add containing the message
* content and type
*
* Returns: schemas.Message: The Message object of the added message
*
* Raises: HTTPException: If the session is not found
*/
create(
appId: string,
Expand All @@ -32,7 +22,7 @@ export class Messages extends APIResource {
}

/**
* Update's the metadata of a message
* Update the metadata of a Message
*/
update(
appId: string,
Expand All @@ -50,15 +40,6 @@ export class Messages extends APIResource {

/**
* Get all messages for a session
*
* Args: app_id (str): The ID of the app representing the client application using
* honcho user_id (str): The User ID representing the user, managed by the user
* session_id (int): The ID of the Session to retrieve reverse (bool): Whether to
* reverse the order of the messages
*
* Returns: list[schemas.Message]: List of Message objects
*
* Raises: HTTPException: If the session is not found
*/
list(
appId: string,
Expand All @@ -76,7 +57,7 @@ export class Messages extends APIResource {
}

/**
* Get Message
* Get a Message by ID
*/
get(
appId: string,
Expand Down
Loading