@wxflows/sdk
Advanced tools
Comparing version 0.2.0-beta.6 to 2.0.0-beta.0
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2024 | ||
// Copyright IBM Corp. 2024, 2025 | ||
// MIT License | ||
@@ -3,0 +3,0 @@ // Copyright (c) 2018 Tim Qian |
export { executeFlow } from './lib/wxflows.js'; | ||
export { fetchTools, type WxflowsTool, type WxflowsToolProperties, } from './lib/chat.js'; | ||
import wxflows from './lib/wxflows.js'; | ||
export default wxflows; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,6 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
export { executeFlow } from './lib/wxflows.js'; | ||
export { fetchTools, } from './lib/chat.js'; | ||
import wxflows from './lib/wxflows.js'; | ||
export default wxflows; | ||
//# sourceMappingURL=index.js.map |
@@ -15,2 +15,3 @@ export type ChatMessage = { | ||
type: 'function'; | ||
__typename: 'TC_GraphQL' | string; | ||
function: { | ||
@@ -27,5 +28,5 @@ name: string; | ||
export type WxflowsToolProperties = { | ||
[key: string]: { | ||
[name: string]: { | ||
type: 'string' | 'boolean' | 'object' | 'number'; | ||
description: string; | ||
type: string; | ||
}; | ||
@@ -32,0 +33,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
import { request } from 'graphql-request'; | ||
@@ -19,2 +19,3 @@ export async function fetchTools({ endpoint, apikey, }) { | ||
type | ||
__typename | ||
... on TC_FunctionTool { | ||
@@ -21,0 +22,0 @@ function { |
@@ -42,5 +42,8 @@ // Copyright IBM Corp. 2023, 2024 | ||
this.execTool = async (name, toolArguments) => { | ||
// assume the tool is a GraphQL tool and can be called directly | ||
// check if the tool is a GraphQL tool and can be called directly | ||
if (toolArguments?.query) { | ||
return await this.execGraphQL(toolArguments.query); | ||
const tools = await this._tools; | ||
if (tools?.find((value) => value.function.name === name && value.__typename === 'TC_GraphQL')) { | ||
return await this.execGraphQL(toolArguments.query); | ||
} | ||
} | ||
@@ -47,0 +50,0 @@ const query = /* GraphQL */ ` |
@@ -1,3 +0,3 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
export {}; | ||
//# sourceMappingURL=types.js.map |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
const defaultRagVariables = { | ||
@@ -3,0 +3,0 @@ n: 10, |
{ | ||
"name": "@wxflows/sdk", | ||
"version": "0.2.0-beta.6", | ||
"version": "2.0.0-beta.0", | ||
"description": "The watsonx Flows Engine SDK", | ||
@@ -65,3 +65,3 @@ "type": "module", | ||
}, | ||
"gitHead": "3804cd2ec8d9bbcb80491b9d25437dcc97b323b0" | ||
"gitHead": "fa2ae750ac6017bfe88fb847a73d680fe565ee0b" | ||
} |
@@ -1,2 +0,2 @@ | ||
Copyright IBM Corp. 2023, 2024 | ||
Copyright IBM Corp. 2023, 2025 | ||
@@ -3,0 +3,0 @@ # wxflows SDK |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2024 | ||
// Copyright IBM Corp. 2024, 2025 | ||
// MIT License | ||
@@ -3,0 +3,0 @@ |
@@ -1,5 +0,10 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
export {executeFlow} from './lib/wxflows.js' | ||
export { | ||
fetchTools, | ||
type WxflowsTool, | ||
type WxflowsToolProperties, | ||
} from './lib/chat.js' | ||
import wxflows from './lib/wxflows.js' | ||
export default wxflows |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
@@ -19,2 +19,3 @@ import {request} from 'graphql-request' | ||
type: 'function' | ||
__typename: 'TC_GraphQL' | string | ||
function: { | ||
@@ -32,5 +33,5 @@ name: string | ||
export type WxflowsToolProperties = { | ||
[key: string]: { | ||
[name: string]: { | ||
type: 'string' | 'boolean' | 'object' | 'number' | ||
description: string | ||
type: string | ||
} | ||
@@ -88,2 +89,3 @@ } | ||
type | ||
__typename | ||
... on TC_FunctionTool { | ||
@@ -90,0 +92,0 @@ function { |
@@ -87,5 +87,14 @@ // Copyright IBM Corp. 2023, 2024 | ||
): Promise<{result: R; error?: never} | {error: string}> => { | ||
// assume the tool is a GraphQL tool and can be called directly | ||
// check if the tool is a GraphQL tool and can be called directly | ||
if (toolArguments?.query) { | ||
return await this.execGraphQL(toolArguments.query) | ||
const tools = await this._tools | ||
if ( | ||
tools?.find( | ||
(value) => | ||
value.function.name === name && value.__typename === 'TC_GraphQL', | ||
) | ||
) { | ||
return await this.execGraphQL(toolArguments.query) | ||
} | ||
} | ||
@@ -92,0 +101,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2023, 2024 | ||
// Copyright IBM Corp. 2023, 2025 | ||
@@ -3,0 +3,0 @@ const defaultRagVariables = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
145248
2969