From 6db7b708611d08d73a98a1a2bc9e6b2d309449a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 02:16:05 +0000 Subject: [PATCH 1/5] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4f980609..84b1878f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-d58ccd91625a3b12fd8d1ceece128b604010bd840096000287c927cb5dcf79eb.yml -openapi_spec_hash: 22c8c973d55f26649e9df96c89ea537f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-f018b83ac489bceb321bc988b6367539365fb59a70fe031f5768d5b50a3ceffa.yml +openapi_spec_hash: e2cecb1f8f97c362436925e6750fed9d config_hash: 1d603d50b7183a492ad6df5f728a1863 From a33888609d3db3f2055eb6fb08859c9c304486ea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 02:32:34 +0000 Subject: [PATCH 2/5] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 84b1878f..5e1a5ef6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-f018b83ac489bceb321bc988b6367539365fb59a70fe031f5768d5b50a3ceffa.yml -openapi_spec_hash: e2cecb1f8f97c362436925e6750fed9d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-c224b4437a8a19d29aa29506fdb44ffc5316d5ba3600feee90678acdb2557e23.yml +openapi_spec_hash: 6b74504e14f7e1aa631e6bd76d596f48 config_hash: 1d603d50b7183a492ad6df5f728a1863 From af242f49a223c9521b713ff6f35343913a3d804f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 19 Apr 2025 03:42:46 +0000 Subject: [PATCH 3/5] feat(api)!: made universal classification endpoint multi-input only --- .stats.yml | 4 +- README.md | 18 +-- packages/mcp-server/README.md | 2 +- .../create-classifications-universal.ts | 17 ++- src/resources/classifications/universal.ts | 106 +++++++++++------- .../classifications/universal.test.ts | 4 +- 6 files changed, 88 insertions(+), 63 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5e1a5ef6..d6a93806 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-c224b4437a8a19d29aa29506fdb44ffc5316d5ba3600feee90678acdb2557e23.yml -openapi_spec_hash: 6b74504e14f7e1aa631e6bd76d596f48 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-213d554b23f35e746460af23dd32bdde471230549ad223518c86d42ea917a180.yml +openapi_spec_hash: 3672281fe031a42fc59e3a2af758a8f8 config_hash: 1d603d50b7183a492ad6df5f728a1863 diff --git a/README.md b/README.md index 0ea4abee..0b37dff7 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,10 @@ async function main() { const universalClassification = await client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], }); - console.log(universalClassification.chunks); + console.log(universalClassification.classifications); } main(); @@ -55,7 +55,7 @@ async function main() { const params: Isaacus.Classifications.UniversalCreateParams = { model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], }; const universalClassification: Isaacus.Classifications.UniversalClassification = await client.classifications.universal.create(params); @@ -79,7 +79,7 @@ async function main() { .create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], }) .catch(async (err) => { if (err instanceof Isaacus.APIError) { @@ -124,7 +124,7 @@ const client = new Isaacus({ }); // Or, configure per-request: -await client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', text: 'I agree not to tell anyone about the document.' }, { +await client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', texts: ['I agree not to tell anyone about the document.'] }, { maxRetries: 5, }); ``` @@ -141,7 +141,7 @@ const client = new Isaacus({ }); // Override per-request: -await client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', text: 'I agree not to tell anyone about the document.' }, { +await client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', texts: ['I agree not to tell anyone about the document.'] }, { timeout: 5 * 1000, }); ``` @@ -168,7 +168,7 @@ const response = await client.classifications.universal .create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], }) .asResponse(); console.log(response.headers.get('X-My-Header')); @@ -178,11 +178,11 @@ const { data: universalClassification, response: raw } = await client.classifica .create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], }) .withResponse(); console.log(raw.headers.get('X-My-Header')); -console.log(universalClassification.chunks); +console.log(universalClassification.classifications); ``` ### Logging diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index 808ce480..fa0ac967 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -93,7 +93,7 @@ The following tools are available in this MCP server. ### Resource `classifications.universal`: -- `create_classifications_universal` (`write`): Classify the relevance of a legal document to a query with an Isaacus universal legal AI classifier. +- `create_classifications_universal` (`write`): Classify the relevance of legal documents to a query with an Isaacus universal legal AI classifier. ### Resource `rerankings`: diff --git a/packages/mcp-server/src/tools/classifications/universal/create-classifications-universal.ts b/packages/mcp-server/src/tools/classifications/universal/create-classifications-universal.ts index 291fa615..4b51f42b 100644 --- a/packages/mcp-server/src/tools/classifications/universal/create-classifications-universal.ts +++ b/packages/mcp-server/src/tools/classifications/universal/create-classifications-universal.ts @@ -13,7 +13,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_classifications_universal', description: - 'Classify the relevance of a legal document to a query with an Isaacus universal legal AI classifier.', + 'Classify the relevance of legal documents to a query with an Isaacus universal legal AI classifier.', inputSchema: { type: 'object', properties: { @@ -26,11 +26,16 @@ export const tool: Tool = { query: { type: 'string', description: - 'The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if IQL is disabled, the statement, to evaluate the text against.\n\nThe query must contain at least one non-whitespace character.\n\nUnlike the text being classified, the query cannot be so long that it exceeds the maximum input length of the universal classifier.', + 'The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if IQL is disabled, the statement, to evaluate the texts against.\n\nThe query must contain at least one non-whitespace character.\n\nUnlike the texts being classified, the query cannot be so long that it exceeds the maximum input length of the universal classifier.', }, - text: { - type: 'string', - description: 'The text to classify.\n\nThe text must contain at least one non-whitespace character.', + texts: { + type: 'array', + description: + 'The texts to classify.\n\nThe texts must contain at least one non-whitespace character.', + items: { + type: 'string', + title: 'Non-blank string', + }, }, chunking_options: { type: 'object', @@ -63,7 +68,7 @@ export const tool: Tool = { scoring_method: { type: 'string', description: - "The method to use for producing an overall confidence score.\n\n`auto` is the default scoring method and is recommended for most use cases. Currently, it is equivalent to `chunk_max`. In the future, it will automatically select the best method based on the model and input.\n\n`chunk_max` uses the highest confidence score of all of the text's chunks.\n\n`chunk_avg` averages the confidence scores of all of the text's chunks.\n\n`chunk_min` uses the lowest confidence score of all of the text's chunks.", + "The method to use for producing an overall confidence score.\n\n`auto` is the default scoring method and is recommended for most use cases. Currently, it is equivalent to `chunk_max`. In the future, it will automatically select the best method based on the model and inputs.\n\n`chunk_max` uses the highest confidence score of all of the texts' chunks.\n\n`chunk_avg` averages the confidence scores of all of the texts' chunks.\n\n`chunk_min` uses the lowest confidence score of all of the texts' chunks.", enum: ['auto', 'chunk_max', 'chunk_avg', 'chunk_min'], }, }, diff --git a/src/resources/classifications/universal.ts b/src/resources/classifications/universal.ts index 7d3d5bc6..7a740329 100644 --- a/src/resources/classifications/universal.ts +++ b/src/resources/classifications/universal.ts @@ -6,7 +6,7 @@ import { RequestOptions } from '../../internal/request-options'; export class Universal extends APIResource { /** - * Classify the relevance of a legal document to a query with an Isaacus universal + * Classify the relevance of legal documents to a query with an Isaacus universal * legal AI classifier. */ create(body: UniversalCreateParams, options?: RequestOptions): APIPromise { @@ -15,27 +15,15 @@ export class Universal extends APIResource { } /** - * A classification of the relevance of a legal document to a query produced by an + * Classifications of the relevance of legal documents to a query produced by an * Isaacus universal legal AI classifier. */ export interface UniversalClassification { /** - * The text as broken into chunks by - * [semchunk](https://github.com/isaacus-dev/semchunk), each chunk with its own - * confidence score, ordered from highest to lowest score. - * - * If no chunking occurred, this will be `null`. - */ - chunks: Array | null; - - /** - * A score of the likelihood that the query expressed about the text is supported - * by the text. - * - * A score greater than `0.5` indicates that the text supports the query, while a - * score less than `0.5` indicates that the text does not support the query. + * The classifications of the texts, by relevance to the query, in order from + * highest to lowest relevance score. */ - score: number; + classifications: Array; /** * Statistics about the usage of resources in the process of classifying the text. @@ -44,35 +32,67 @@ export interface UniversalClassification { } export namespace UniversalClassification { - export interface Chunk { + export interface Classification { /** - * The end index of the chunk in the original text. + * The text as broken into chunks by + * [semchunk](https://github.com/isaacus-dev/semchunk), each chunk with its own + * confidence score, ordered from highest to lowest score. + * + * If no chunking occurred, this will be `null`. */ - end: number; + chunks: Array | null; /** - * The index of the chunk in the list of chunks. + * The index of the text in the input array of texts, starting from `0` (and, + * therefore, ending at the number of texts minus `1`). */ index: number; /** - * The model's score of the likelihood that the query expressed about the chunk is - * supported by the chunk. + * A score of the likelihood that the query expressed about the text is supported + * by the text. * - * A score greater than `0.5` indicates that the chunk supports the query, while a - * score less than `0.5` indicates that the chunk does not support the query. + * A score greater than `0.5` indicates that the text supports the query, while a + * score less than `0.5` indicates that the text does not support the query. */ score: number; + } - /** - * The start index of the chunk in the original text. - */ - start: number; - - /** - * The text of the chunk. - */ - text: string; + export namespace Classification { + export interface Chunk { + /** + * The index of the character in the original text where the chunk ends, beginning + * from `0` (such that, in Python, the chunk is equivalent to `text[start:end+1]`). + */ + end: number; + + /** + * The original position of the chunk in the outputted list of chunks before + * sorting, starting from `0` (and, therefore, ending at the number of chunks minus + * `1`). + */ + index: number; + + /** + * The model's score of the likelihood that the query expressed about the chunk is + * supported by the chunk. + * + * A score greater than `0.5` indicates that the chunk supports the query, while a + * score less than `0.5` indicates that the chunk does not support the query. + */ + score: number; + + /** + * The index of the character in the original text where the chunk starts, + * beginning from `0`. + */ + start: number; + + /** + * The text of the chunk. + */ + text: string; + } } /** @@ -95,21 +115,21 @@ export interface UniversalCreateParams { /** * The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if - * IQL is disabled, the statement, to evaluate the text against. + * IQL is disabled, the statement, to evaluate the texts against. * * The query must contain at least one non-whitespace character. * - * Unlike the text being classified, the query cannot be so long that it exceeds + * Unlike the texts being classified, the query cannot be so long that it exceeds * the maximum input length of the universal classifier. */ query: string; /** - * The text to classify. + * The texts to classify. * - * The text must contain at least one non-whitespace character. + * The texts must contain at least one non-whitespace character. */ - text: string; + texts: Array; /** * Options for how to split text into smaller chunks. @@ -127,13 +147,13 @@ export interface UniversalCreateParams { * * `auto` is the default scoring method and is recommended for most use cases. * Currently, it is equivalent to `chunk_max`. In the future, it will automatically - * select the best method based on the model and input. + * select the best method based on the model and inputs. * - * `chunk_max` uses the highest confidence score of all of the text's chunks. + * `chunk_max` uses the highest confidence score of all of the texts' chunks. * - * `chunk_avg` averages the confidence scores of all of the text's chunks. + * `chunk_avg` averages the confidence scores of all of the texts' chunks. * - * `chunk_min` uses the lowest confidence score of all of the text's chunks. + * `chunk_min` uses the lowest confidence score of all of the texts' chunks. */ scoring_method?: 'auto' | 'chunk_max' | 'chunk_avg' | 'chunk_min'; } diff --git a/tests/api-resources/classifications/universal.test.ts b/tests/api-resources/classifications/universal.test.ts index a5de14d0..7ab9fc5f 100644 --- a/tests/api-resources/classifications/universal.test.ts +++ b/tests/api-resources/classifications/universal.test.ts @@ -13,7 +13,7 @@ describe('resource universal', () => { const responsePromise = client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -29,7 +29,7 @@ describe('resource universal', () => { const response = await client.classifications.universal.create({ model: 'kanon-universal-classifier', query: 'This is a confidentiality clause.', - text: 'I agree not to tell anyone about the document.', + texts: ['I agree not to tell anyone about the document.'], chunking_options: { overlap_ratio: 0.1, overlap_tokens: 0, size: 512 }, is_iql: true, scoring_method: 'auto', From 988029399c9c70c4904fbbe41d0794f5016de9ca Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 19 Apr 2025 03:44:42 +0000 Subject: [PATCH 4/5] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d6a93806..43b9aaeb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-213d554b23f35e746460af23dd32bdde471230549ad223518c86d42ea917a180.yml openapi_spec_hash: 3672281fe031a42fc59e3a2af758a8f8 -config_hash: 1d603d50b7183a492ad6df5f728a1863 +config_hash: 1d15d860383a3f6da1ac388297687cc9 From 4cce17f41b249fa075cc5802bfd91d955c2e6e49 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 19 Apr 2025 03:44:57 +0000 Subject: [PATCH 5/5] release: 0.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- packages/mcp-server/package.json | 2 +- packages/mcp-server/src/server.ts | 2 +- src/version.ts | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 210d2903..bcd05228 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.1" + ".": "0.6.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 90cfe799..97b6468d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.6.0 (2025-04-19) + +Full Changelog: [v0.5.1...v0.6.0](https://github.com/isaacus-dev/isaacus-typescript/compare/v0.5.1...v0.6.0) + +### ⚠ BREAKING CHANGES + +* **api:** made universal classification endpoint multi-input only + +### Features + +* **api:** made universal classification endpoint multi-input only ([af242f4](https://github.com/isaacus-dev/isaacus-typescript/commit/af242f49a223c9521b713ff6f35343913a3d804f)) + ## 0.5.1 (2025-04-16) Full Changelog: [v0.5.0...v0.5.1](https://github.com/isaacus-dev/isaacus-typescript/compare/v0.5.0...v0.5.1) diff --git a/package.json b/package.json index ec91a617..cfd1939a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isaacus", - "version": "0.5.1", + "version": "0.6.0", "description": "The official TypeScript library for the Isaacus API", "author": "Isaacus ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 4852f1d0..5771ec0b 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "isaacus-mcp", - "version": "0.5.1", + "version": "0.6.0", "description": "The official MCP Server for the Isaacus API", "author": "Isaacus ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index 23ae2cb5..6423a0b1 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -11,7 +11,7 @@ export { endpoints } from './tools'; export const server = new McpServer( { name: 'isaacus_api', - version: '0.5.1', + version: '0.6.0', }, { capabilities: { diff --git a/src/version.ts b/src/version.ts index 44c3338a..30c28175 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.5.1'; // x-release-please-version +export const VERSION = '0.6.0'; // x-release-please-version