@modelprofile.com/flexharness-providers 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts_media_openai/image.d.ts +46 -0
- package/dist_ts_media_openai/image.js +110 -0
- package/dist_ts_media_openai/index.d.ts +10 -0
- package/dist_ts_media_openai/index.js +16 -0
- package/dist_ts_media_openai/plugins.d.ts +3 -0
- package/dist_ts_media_openai/plugins.js +4 -0
- package/dist_ts_openai_account/index.d.ts +6 -0
- package/dist_ts_openai_account/index.js +7 -0
- package/dist_ts_openai_account/plugins.d.ts +7 -0
- package/dist_ts_openai_account/plugins.js +6 -0
- package/dist_ts_openai_account/smartai.providers.credentials.d.ts +7 -0
- package/dist_ts_openai_account/smartai.providers.credentials.js +126 -0
- package/dist_ts_openai_account/smartai.providers.error.d.ts +11 -0
- package/dist_ts_openai_account/smartai.providers.error.js +30 -0
- package/dist_ts_openai_account/smartai.providers.interfaces.d.ts +161 -0
- package/dist_ts_openai_account/smartai.providers.interfaces.js +2 -0
- package/dist_ts_openai_account/smartai.providers.openai.d.ts +29 -0
- package/dist_ts_openai_account/smartai.providers.openai.js +1075 -0
- package/dist_ts_openai_account/smartai.providers.registry.d.ts +11 -0
- package/dist_ts_openai_account/smartai.providers.registry.js +53 -0
- package/dist_ts_openai_auth/index.d.ts +6 -0
- package/dist_ts_openai_auth/index.js +10 -0
- package/dist_ts_openai_auth/interfaces.d.ts +71 -0
- package/dist_ts_openai_auth/interfaces.js +2 -0
- package/dist_ts_openai_auth/smartai.auth.openai.d.ts +34 -0
- package/dist_ts_openai_auth/smartai.auth.openai.js +603 -0
- package/dist_ts_openai_auth/smartai.middleware.openai.d.ts +6 -0
- package/dist_ts_openai_auth/smartai.middleware.openai.js +47 -0
- package/dist_ts_openai_auth_files/index.d.ts +43 -0
- package/dist_ts_openai_auth_files/index.js +377 -0
- package/dist_ts_openai_auth_files/plugins.d.ts +9 -0
- package/dist_ts_openai_auth_files/plugins.js +10 -0
- package/dist_ts_providers/anthropic/index.d.ts +8 -0
- package/dist_ts_providers/anthropic/index.js +13 -0
- package/dist_ts_providers/anthropic/plugins.d.ts +4 -0
- package/dist_ts_providers/anthropic/plugins.js +4 -0
- package/dist_ts_providers/anthropic/smartai.middleware.anthropic.d.ts +8 -0
- package/dist_ts_providers/anthropic/smartai.middleware.anthropic.js +10 -0
- package/dist_ts_providers/google/index.d.ts +5 -0
- package/dist_ts_providers/google/index.js +6 -0
- package/dist_ts_providers/google/plugins.d.ts +3 -0
- package/dist_ts_providers/google/plugins.js +3 -0
- package/dist_ts_providers/groq/index.d.ts +5 -0
- package/dist_ts_providers/groq/index.js +6 -0
- package/dist_ts_providers/groq/plugins.d.ts +3 -0
- package/dist_ts_providers/groq/plugins.js +3 -0
- package/dist_ts_providers/index.d.ts +8 -0
- package/dist_ts_providers/index.js +9 -0
- package/dist_ts_providers/mistral/index.d.ts +5 -0
- package/dist_ts_providers/mistral/index.js +6 -0
- package/dist_ts_providers/mistral/plugins.d.ts +3 -0
- package/dist_ts_providers/mistral/plugins.js +3 -0
- package/dist_ts_providers/ollama/index.d.ts +6 -0
- package/dist_ts_providers/ollama/index.js +7 -0
- package/dist_ts_providers/ollama/interfaces.d.ts +26 -0
- package/dist_ts_providers/ollama/interfaces.js +2 -0
- package/dist_ts_providers/ollama/smartai.provider.ollama.d.ts +8 -0
- package/dist_ts_providers/ollama/smartai.provider.ollama.js +378 -0
- package/dist_ts_providers/openai/index.d.ts +15 -0
- package/dist_ts_providers/openai/index.js +14 -0
- package/dist_ts_providers/openai/plugins.d.ts +6 -0
- package/dist_ts_providers/openai/plugins.js +4 -0
- package/dist_ts_providers/perplexity/index.d.ts +5 -0
- package/dist_ts_providers/perplexity/index.js +6 -0
- package/dist_ts_providers/perplexity/plugins.d.ts +3 -0
- package/dist_ts_providers/perplexity/plugins.js +3 -0
- package/dist_ts_providers/xai/index.d.ts +5 -0
- package/dist_ts_providers/xai/index.js +6 -0
- package/dist_ts_providers/xai/plugins.d.ts +3 -0
- package/dist_ts_providers/xai/plugins.js +3 -0
- package/dist_ts_research/index.d.ts +19 -0
- package/dist_ts_research/index.js +98 -0
- package/dist_ts_research/plugins.d.ts +2 -0
- package/dist_ts_research/plugins.js +3 -0
- package/license.md +21 -0
- package/openai-codex-license.txt +201 -0
- package/package.json +105 -0
- package/readme.md +62 -0
- package/third-party-notices.md +19 -0
- package/ts_media_openai/image.ts +147 -0
- package/ts_media_openai/index.ts +26 -0
- package/ts_media_openai/plugins.ts +3 -0
- package/ts_media_openai/readme.md +37 -0
- package/ts_openai_account/index.ts +11 -0
- package/ts_openai_account/plugins.ts +9 -0
- package/ts_openai_account/readme.md +37 -0
- package/ts_openai_account/smartai.providers.credentials.ts +163 -0
- package/ts_openai_account/smartai.providers.error.ts +49 -0
- package/ts_openai_account/smartai.providers.interfaces.ts +222 -0
- package/ts_openai_account/smartai.providers.openai.ts +1209 -0
- package/ts_openai_account/smartai.providers.registry.ts +57 -0
- package/ts_openai_auth/index.ts +12 -0
- package/ts_openai_auth/interfaces.ts +89 -0
- package/ts_openai_auth/readme.md +37 -0
- package/ts_openai_auth/smartai.auth.openai.ts +789 -0
- package/ts_openai_auth/smartai.middleware.openai.ts +55 -0
- package/ts_openai_auth_files/index.ts +499 -0
- package/ts_openai_auth_files/plugins.ts +13 -0
- package/ts_openai_auth_files/readme.md +37 -0
- package/ts_providers/anthropic/index.ts +20 -0
- package/ts_providers/anthropic/plugins.ts +4 -0
- package/ts_providers/anthropic/readme.md +37 -0
- package/ts_providers/anthropic/smartai.middleware.anthropic.ts +12 -0
- package/ts_providers/google/index.ts +8 -0
- package/ts_providers/google/plugins.ts +3 -0
- package/ts_providers/google/readme.md +37 -0
- package/ts_providers/groq/index.ts +8 -0
- package/ts_providers/groq/plugins.ts +3 -0
- package/ts_providers/groq/readme.md +37 -0
- package/ts_providers/index.ts +8 -0
- package/ts_providers/mistral/index.ts +8 -0
- package/ts_providers/mistral/plugins.ts +3 -0
- package/ts_providers/mistral/readme.md +37 -0
- package/ts_providers/ollama/index.ts +8 -0
- package/ts_providers/ollama/interfaces.ts +28 -0
- package/ts_providers/ollama/readme.md +37 -0
- package/ts_providers/ollama/smartai.provider.ollama.ts +426 -0
- package/ts_providers/openai/index.ts +29 -0
- package/ts_providers/openai/plugins.ts +6 -0
- package/ts_providers/openai/readme.md +37 -0
- package/ts_providers/perplexity/index.ts +8 -0
- package/ts_providers/perplexity/plugins.ts +3 -0
- package/ts_providers/perplexity/readme.md +37 -0
- package/ts_providers/readme.md +62 -0
- package/ts_providers/xai/index.ts +8 -0
- package/ts_providers/xai/plugins.ts +3 -0
- package/ts_providers/xai/readme.md +37 -0
- package/ts_research/index.ts +120 -0
- package/ts_research/plugins.ts +2 -0
- package/ts_research/readme.md +37 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export type TOpenAiReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
4
|
+
export type TOpenAiTextVerbosity = 'low' | 'medium' | 'high';
|
|
5
|
+
export interface IOpenAiProviderOptions extends plugins.JSONObject, plugins.OpenAIResponsesProviderOptions {}
|
|
6
|
+
|
|
7
|
+
/** The provider owns inference; optional authentication components supply this connection. */
|
|
8
|
+
export interface IOpenAiModelConnection {
|
|
9
|
+
settings: plugins.OpenAIProviderSettings;
|
|
10
|
+
middleware?: plugins.LanguageModelV4Middleware;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IOpenAiModelOptions extends plugins.ISmartAiOptions {
|
|
14
|
+
provider: 'openai';
|
|
15
|
+
connection?: IOpenAiModelConnection;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const createOpenAiModelProvider = (): plugins.IModelProvider<IOpenAiModelOptions> => ({
|
|
19
|
+
id: 'openai',
|
|
20
|
+
getModel: (options) => {
|
|
21
|
+
const model = plugins.createOpenAI(options.connection?.settings ?? {
|
|
22
|
+
apiKey: options.apiKey,
|
|
23
|
+
...(options.baseUrl ? { baseURL: options.baseUrl } : {}),
|
|
24
|
+
})(options.model);
|
|
25
|
+
return options.connection?.middleware
|
|
26
|
+
? plugins.wrapLanguageModel({ model, middleware: options.connection.middleware })
|
|
27
|
+
: model;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
2
|
+
import { wrapLanguageModel } from 'ai';
|
|
3
|
+
export { createOpenAI, wrapLanguageModel };
|
|
4
|
+
export type { OpenAIProviderSettings, OpenAIResponsesProviderOptions } from '@ai-sdk/openai';
|
|
5
|
+
export type { LanguageModelV4Middleware } from '@ai-sdk/provider';
|
|
6
|
+
export type { IModelProvider, ISmartAiOptions, JSONObject } from '@modelprofile.com/flexharness-models';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Explicit openai model provider for FlexHarness models and the AI SDK.
|
|
2
|
+
|
|
3
|
+
Part of the [FlexHarness toolbox](https://code.foss.global/modelprofile.com/flexharness).
|
|
4
|
+
Install the components your project uses. Provider adapters are registered explicitly;
|
|
5
|
+
the agent and harness do not install or register vendor SDKs.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @modelprofile.com/flexharness-providers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the [toolbox usage and migration guide](https://code.foss.global/modelprofile.com/flexharness#readme)
|
|
12
|
+
for composition examples and the SmartAI/SmartAgent migration map.
|
|
13
|
+
|
|
14
|
+
## Issue Reporting and Security
|
|
15
|
+
|
|
16
|
+
Report issues and security concerns through [community.foss.global](https://community.foss.global).
|
|
17
|
+
|
|
18
|
+
## License and Legal Information
|
|
19
|
+
|
|
20
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
|
|
21
|
+
|
|
22
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
23
|
+
|
|
24
|
+
### Trademarks
|
|
25
|
+
|
|
26
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
27
|
+
|
|
28
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
29
|
+
|
|
30
|
+
### Company Information
|
|
31
|
+
|
|
32
|
+
Task Venture Capital GmbH<br>
|
|
33
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
34
|
+
|
|
35
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
36
|
+
|
|
37
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export interface IPerplexityModelOptions extends plugins.ISmartAiOptions { provider: 'perplexity'; }
|
|
4
|
+
|
|
5
|
+
export const createPerplexityModelProvider = (): plugins.IModelProvider<IPerplexityModelOptions> => ({
|
|
6
|
+
id: 'perplexity',
|
|
7
|
+
getModel: (options) => plugins.createPerplexity({ apiKey: options.apiKey })(options.model),
|
|
8
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Explicit perplexity model provider for FlexHarness models and the AI SDK.
|
|
2
|
+
|
|
3
|
+
Part of the [FlexHarness toolbox](https://code.foss.global/modelprofile.com/flexharness).
|
|
4
|
+
Install the components your project uses. Provider adapters are registered explicitly;
|
|
5
|
+
the agent and harness do not install or register vendor SDKs.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @modelprofile.com/flexharness-providers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the [toolbox usage and migration guide](https://code.foss.global/modelprofile.com/flexharness#readme)
|
|
12
|
+
for composition examples and the SmartAI/SmartAgent migration map.
|
|
13
|
+
|
|
14
|
+
## Issue Reporting and Security
|
|
15
|
+
|
|
16
|
+
Report issues and security concerns through [community.foss.global](https://community.foss.global).
|
|
17
|
+
|
|
18
|
+
## License and Legal Information
|
|
19
|
+
|
|
20
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
|
|
21
|
+
|
|
22
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
23
|
+
|
|
24
|
+
### Trademarks
|
|
25
|
+
|
|
26
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
27
|
+
|
|
28
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
29
|
+
|
|
30
|
+
### Company Information
|
|
31
|
+
|
|
32
|
+
Task Venture Capital GmbH<br>
|
|
33
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
34
|
+
|
|
35
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
36
|
+
|
|
37
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
FlexHarness Providers supplies all model adapters and provider capabilities in one package. Import a specific subpath to select the implementation you use.
|
|
2
|
+
|
|
3
|
+
## Issue Reporting and Security
|
|
4
|
+
|
|
5
|
+
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
|
6
|
+
|
|
7
|
+
## Install and use
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @modelprofile.com/flexharness-providers @modelprofile.com/flexharness-models
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ModelRegistry } from '@modelprofile.com/flexharness-models';
|
|
15
|
+
import { createOpenAiModelProvider } from '@modelprofile.com/flexharness-providers/openai';
|
|
16
|
+
|
|
17
|
+
const models = new ModelRegistry().register(createOpenAiModelProvider());
|
|
18
|
+
const model = models.getModel({ provider: 'openai', model: 'gpt-5.5', apiKey: process.env.OPENAI_API_KEY });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Provider subpaths
|
|
22
|
+
|
|
23
|
+
Install `@modelprofile.com/flexharness-providers` once. Its root exports all provider
|
|
24
|
+
factories; use a provider subpath to import just that implementation.
|
|
25
|
+
|
|
26
|
+
| Import suffix | Capability |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `/anthropic`, `/openai`, `/google`, `/groq`, `/mistral`, `/xai`, `/perplexity`, `/ollama` | Model adapters and their request types |
|
|
29
|
+
| `/auth` | ChatGPT browser/device authentication, refresh and model connections |
|
|
30
|
+
| `/accounts` | Account lifecycle, model catalogs, rate limits and credential envelopes |
|
|
31
|
+
| `/auth/files` | Explicit interoperability with external credential files |
|
|
32
|
+
| `/media` | OpenAI audio and image generation |
|
|
33
|
+
| `/research` | Anthropic research utilities |
|
|
34
|
+
|
|
35
|
+
Provider SDKs are installed together. Authentication, file access and vendor media
|
|
36
|
+
are separate entrypoints and are not imported by the provider factory root. For
|
|
37
|
+
ChatGPT authentication, pass
|
|
38
|
+
`connection: createOpenAiChatGptModelConnection(credentials)` from `/auth` to the
|
|
39
|
+
OpenAI model options. API-key inference needs no authentication setup.
|
|
40
|
+
|
|
41
|
+
The package includes the applicable OpenAI Codex license and third-party notices.
|
|
42
|
+
|
|
43
|
+
## License and Legal Information
|
|
44
|
+
|
|
45
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
|
|
46
|
+
|
|
47
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
### Trademarks
|
|
50
|
+
|
|
51
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
52
|
+
|
|
53
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
54
|
+
|
|
55
|
+
### Company Information
|
|
56
|
+
|
|
57
|
+
Task Venture Capital GmbH<br>
|
|
58
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
59
|
+
|
|
60
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
61
|
+
|
|
62
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export interface IXaiModelOptions extends plugins.ISmartAiOptions { provider: 'xai'; }
|
|
4
|
+
|
|
5
|
+
export const createXaiModelProvider = (): plugins.IModelProvider<IXaiModelOptions> => ({
|
|
6
|
+
id: 'xai',
|
|
7
|
+
getModel: (options) => plugins.createXai({ apiKey: options.apiKey })(options.model),
|
|
8
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Explicit xai model provider for FlexHarness models and the AI SDK.
|
|
2
|
+
|
|
3
|
+
Part of the [FlexHarness toolbox](https://code.foss.global/modelprofile.com/flexharness).
|
|
4
|
+
Install the components your project uses. Provider adapters are registered explicitly;
|
|
5
|
+
the agent and harness do not install or register vendor SDKs.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @modelprofile.com/flexharness-providers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the [toolbox usage and migration guide](https://code.foss.global/modelprofile.com/flexharness#readme)
|
|
12
|
+
for composition examples and the SmartAI/SmartAgent migration map.
|
|
13
|
+
|
|
14
|
+
## Issue Reporting and Security
|
|
15
|
+
|
|
16
|
+
Report issues and security concerns through [community.foss.global](https://community.foss.global).
|
|
17
|
+
|
|
18
|
+
## License and Legal Information
|
|
19
|
+
|
|
20
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
|
|
21
|
+
|
|
22
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
23
|
+
|
|
24
|
+
### Trademarks
|
|
25
|
+
|
|
26
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
27
|
+
|
|
28
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
29
|
+
|
|
30
|
+
### Company Information
|
|
31
|
+
|
|
32
|
+
Task Venture Capital GmbH<br>
|
|
33
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
34
|
+
|
|
35
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
36
|
+
|
|
37
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export interface IResearchOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
query: string;
|
|
6
|
+
searchDepth?: 'basic' | 'advanced' | 'deep';
|
|
7
|
+
maxSources?: number;
|
|
8
|
+
allowedDomains?: string[];
|
|
9
|
+
blockedDomains?: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IResearchResponse {
|
|
13
|
+
answer: string;
|
|
14
|
+
sources: Array<{ url: string; title: string; snippet: string }>;
|
|
15
|
+
searchQueries?: string[];
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function research(options: IResearchOptions): Promise<IResearchResponse> {
|
|
20
|
+
const client = new plugins.Anthropic({ apiKey: options.apiKey });
|
|
21
|
+
|
|
22
|
+
const systemMessage = `You are a research assistant with web search capabilities.
|
|
23
|
+
Provide comprehensive, well-researched answers with citations and sources.
|
|
24
|
+
When searching the web, be thorough and cite your sources accurately.`;
|
|
25
|
+
|
|
26
|
+
// Build web search tool config
|
|
27
|
+
const webSearchTool: any = {
|
|
28
|
+
type: 'web_search_20250305',
|
|
29
|
+
name: 'web_search',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
if (options.maxSources) {
|
|
33
|
+
webSearchTool.max_uses = options.maxSources;
|
|
34
|
+
}
|
|
35
|
+
if (options.allowedDomains?.length) {
|
|
36
|
+
webSearchTool.allowed_domains = options.allowedDomains;
|
|
37
|
+
} else if (options.blockedDomains?.length) {
|
|
38
|
+
webSearchTool.blocked_domains = options.blockedDomains;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const result = await client.messages.create({
|
|
42
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
43
|
+
system: systemMessage,
|
|
44
|
+
messages: [
|
|
45
|
+
{ role: 'user' as const, content: options.query },
|
|
46
|
+
],
|
|
47
|
+
max_tokens: 20000,
|
|
48
|
+
temperature: 0.7,
|
|
49
|
+
tools: [webSearchTool],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Extract answer, sources, and search queries
|
|
53
|
+
let answer = '';
|
|
54
|
+
const sources: Array<{ url: string; title: string; snippet: string }> = [];
|
|
55
|
+
const searchQueries: string[] = [];
|
|
56
|
+
|
|
57
|
+
for (const block of result.content) {
|
|
58
|
+
const b: any = block;
|
|
59
|
+
if ('text' in b) {
|
|
60
|
+
answer += b.text;
|
|
61
|
+
|
|
62
|
+
// Extract citations if present
|
|
63
|
+
if (b.citations && Array.isArray(b.citations)) {
|
|
64
|
+
for (const citation of b.citations) {
|
|
65
|
+
if (citation.type === 'web_search_result_location') {
|
|
66
|
+
sources.push({
|
|
67
|
+
title: citation.title || '',
|
|
68
|
+
url: citation.url || '',
|
|
69
|
+
snippet: citation.cited_text || '',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} else if (b.type === 'server_tool_use') {
|
|
75
|
+
if (b.name === 'web_search' && b.input?.query) {
|
|
76
|
+
searchQueries.push(b.input.query);
|
|
77
|
+
}
|
|
78
|
+
} else if (b.type === 'web_search_tool_result') {
|
|
79
|
+
if (Array.isArray(b.content)) {
|
|
80
|
+
for (const item of b.content) {
|
|
81
|
+
if (item.type === 'web_search_result') {
|
|
82
|
+
if (!sources.some(s => s.url === item.url)) {
|
|
83
|
+
sources.push({
|
|
84
|
+
title: item.title || '',
|
|
85
|
+
url: item.url || '',
|
|
86
|
+
snippet: '',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Fallback: parse markdown links if no citations found
|
|
96
|
+
if (sources.length === 0) {
|
|
97
|
+
const urlRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
98
|
+
let match: RegExpExecArray | null;
|
|
99
|
+
while ((match = urlRegex.exec(answer)) !== null) {
|
|
100
|
+
sources.push({
|
|
101
|
+
title: match[1],
|
|
102
|
+
url: match[2],
|
|
103
|
+
snippet: '',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const usage: any = result.usage;
|
|
109
|
+
return {
|
|
110
|
+
answer,
|
|
111
|
+
sources,
|
|
112
|
+
searchQueries: searchQueries.length > 0 ? searchQueries : undefined,
|
|
113
|
+
metadata: {
|
|
114
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
115
|
+
searchDepth: options.searchDepth || 'basic',
|
|
116
|
+
tokensUsed: usage?.output_tokens,
|
|
117
|
+
webSearchesPerformed: usage?.server_tool_use?.web_search_requests ?? 0,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Anthropic research utilities.
|
|
2
|
+
|
|
3
|
+
Part of the [FlexHarness toolbox](https://code.foss.global/modelprofile.com/flexharness).
|
|
4
|
+
Install the components your project uses. Provider adapters are registered explicitly;
|
|
5
|
+
the agent and harness do not install or register vendor SDKs.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @modelprofile.com/flexharness-providers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the [toolbox usage and migration guide](https://code.foss.global/modelprofile.com/flexharness#readme)
|
|
12
|
+
for composition examples and the SmartAI/SmartAgent migration map.
|
|
13
|
+
|
|
14
|
+
## Issue Reporting and Security
|
|
15
|
+
|
|
16
|
+
Report issues and security concerns through [community.foss.global](https://community.foss.global).
|
|
17
|
+
|
|
18
|
+
## License and Legal Information
|
|
19
|
+
|
|
20
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
|
|
21
|
+
|
|
22
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
23
|
+
|
|
24
|
+
### Trademarks
|
|
25
|
+
|
|
26
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
27
|
+
|
|
28
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
29
|
+
|
|
30
|
+
### Company Information
|
|
31
|
+
|
|
32
|
+
Task Venture Capital GmbH<br>
|
|
33
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
34
|
+
|
|
35
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
36
|
+
|
|
37
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|