@promptbook/vercel 0.77.0-6 โ 0.77.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/README.md
CHANGED
|
@@ -23,10 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
<blockquote style="color: #ff8811">
|
|
27
|
-
<b>โ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
-
</blockquote>
|
|
29
|
-
|
|
30
26
|
## ๐ฆ Package `@promptbook/vercel`
|
|
31
27
|
|
|
32
28
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -42,7 +38,64 @@ npm i ptbk
|
|
|
42
38
|
npm install @promptbook/vercel
|
|
43
39
|
```
|
|
44
40
|
|
|
41
|
+
`@promptbook/vercel` is adapter for all [Vercel AI SDK model providers](https://sdk.vercel.ai/providers/ai-sdk-providers).
|
|
42
|
+
|
|
43
|
+
## ๐งก Usage
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
47
|
+
import { usageToHuman } from '@promptbook/core';
|
|
48
|
+
import type { Prompt } from '@promptbook/types';
|
|
49
|
+
import { createExecutionToolsFromVercelProvider } from '@promptbook/vercel';
|
|
50
|
+
import colors from 'colors';
|
|
51
|
+
import * as dotenv from 'dotenv';
|
|
52
|
+
|
|
53
|
+
dotenv.config({ path: '.env' });
|
|
54
|
+
|
|
55
|
+
const openaiVercelProvider = createOpenAI({
|
|
56
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const openaiPromptbookExecutionTools = createExecutionToolsFromVercelProvider({
|
|
60
|
+
title: 'OpenAI',
|
|
61
|
+
vercelProvider: openaiVercelProvider,
|
|
62
|
+
availableModels: [],
|
|
63
|
+
additionalChatSettings: {
|
|
64
|
+
// ...
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**/
|
|
69
|
+
const chatPrompt = {
|
|
70
|
+
title: 'Joke',
|
|
71
|
+
parameters: {},
|
|
72
|
+
content: `Write a joke`,
|
|
73
|
+
modelRequirements: {
|
|
74
|
+
modelVariant: 'CHAT',
|
|
75
|
+
modelName: 'gpt-3.5-turbo',
|
|
76
|
+
systemMessage: 'You are an assistant who only speaks in rhymes.',
|
|
77
|
+
temperature: 1.5,
|
|
78
|
+
},
|
|
79
|
+
} as const satisfies Prompt;
|
|
80
|
+
const chatPromptResult = await openaiPromptbookExecutionTools.callChatModel!(chatPrompt);
|
|
81
|
+
console.info({ chatPromptResult });
|
|
82
|
+
console.info(colors.cyan(usageToHuman(chatPromptResult.usage)));
|
|
83
|
+
console.info(colors.bgBlue(' User: ') + colors.blue(chatPrompt.content));
|
|
84
|
+
console.info(colors.bgGreen(' Chat: ') + colors.green(chatPromptResult.content));
|
|
85
|
+
/**/
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## ๐ Integration with other models
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
See the other model integrations:
|
|
45
93
|
|
|
94
|
+
- [OpenAI](https://www.npmjs.com/package/@promptbook/openai)
|
|
95
|
+
- [Anthropic Claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)
|
|
96
|
+
- [Google Gemini](https://www.npmjs.com/package/@promptbook/google)
|
|
97
|
+
- [Vercel](https://www.npmjs.com/package/@promptbook/vercel)
|
|
98
|
+
- [Azure OpenAI](https://www.npmjs.com/package/@promptbook/azure-openai)
|
|
46
99
|
|
|
47
100
|
|
|
48
101
|
---
|
package/esm/index.es.js
CHANGED
|
@@ -13,7 +13,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
13
13
|
*
|
|
14
14
|
* @see https://github.com/webgptorg/promptbook
|
|
15
15
|
*/
|
|
16
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-
|
|
16
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-6';
|
|
17
17
|
/**
|
|
18
18
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
19
19
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -10,9 +10,5 @@ export declare const createGoogleExecutionTools: ((options: GoogleExecutionTools
|
|
|
10
10
|
className: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [๐ง ][main] !!!! Make anonymous this with all LLM providers
|
|
14
|
-
* TODO: [๐ง ][๐งฑ][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
|
|
15
|
-
* TODO: [๐ง ] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
16
|
-
* TODO: [๐ฆบ] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
17
13
|
* TODO: [๐ถ] Naming "constructor" vs "creator" vs "factory"
|
|
18
14
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/vercel",
|
|
3
|
-
"version": "0.77.0
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [๐]",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/vercel.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.77.0
|
|
57
|
+
"@promptbook/core": "0.77.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*
|
|
22
22
|
* @see https://github.com/webgptorg/promptbook
|
|
23
23
|
*/
|
|
24
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-
|
|
24
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-6';
|
|
25
25
|
/**
|
|
26
26
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
27
27
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|