New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@promptbook/google

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@promptbook/google - npm Package Compare versions

Comparing version 0.77.0-6 to 0.77.0

8

esm/index.es.js

@@ -16,3 +16,3 @@ import colors from 'colors';

*/
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-5';
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-6';
/**

@@ -759,3 +759,3 @@ * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine

return createExecutionToolsFromVercelProvider(__assign({ title: 'Google', description: 'Implementation of Google models', vercelProvider: googleGeminiVercelProvider, availableModels: [
// TODO: !!!!!! Maybe list models in same way as in other providers
// TODO: [๐Ÿ•˜] Maybe list models in same way as in other providers - in separate file with metadata
'gemini-1.5-flash',

@@ -782,6 +782,2 @@ 'gemini-1.5-flash-latest',

/**
* TODO: [๐Ÿง ][main] !!!! Make anonymous this with all LLM providers
* TODO: [๐Ÿง ][๐Ÿงฑ][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
* TODO: [๐Ÿง ] Maybe auto-detect usage in browser and determine default value of `isProxied`
* TODO: [๐Ÿฆบ] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
* TODO: [๐ŸŽถ] Naming "constructor" vs "creator" vs "factory"

@@ -788,0 +784,0 @@ */

@@ -37,3 +37,3 @@ import type { ModelVariant } from '../types/ModelVariant';

/**
* TODO: !!!!!! Put pricing information here
* TODO: (not only [๐Ÿ•˜]) Put pricing information here
*/

@@ -13,7 +13,3 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';

/**
* TODO: [๐Ÿง ][main] !!!! Make anonymous this with all LLM providers
* TODO: [๐Ÿง ][๐Ÿงฑ][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
* TODO: [๐Ÿง ] Maybe auto-detect usage in browser and determine default value of `isProxied`
* TODO: [๐Ÿฆบ] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
* TODO: [๐ŸŽถ] Naming "constructor" vs "creator" vs "factory"
*/
{
"name": "@promptbook/google",
"version": "0.77.0-6",
"version": "0.77.0",
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",

@@ -57,3 +57,3 @@ "--note-0": " <- [๐ŸŠ]",

"peerDependencies": {
"@promptbook/core": "0.77.0-6"
"@promptbook/core": "0.77.0"
},

@@ -60,0 +60,0 @@ "dependencies": {

@@ -26,6 +26,2 @@ <!-- โš ๏ธ WARNING: This code has been generated so that any manual changes will be overwritten -->

<blockquote style="color: #ff8811">
<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>.
</blockquote>
## ๐Ÿ“ฆ Package `@promptbook/google`

@@ -46,7 +42,174 @@

`@promptbook/anthropic-claude` integrates [Google's Gemini API](https://gemini.google.com/) with [Promptbook](https://github.com/webgptorg/promptbook). It allows to execute Promptbooks with Gemini models.
`@promptbook/google` integrates [Google's Gemini API](https://gemini.google.com/) with [Promptbook](https://github.com/webgptorg/promptbook). It allows to execute Promptbooks with Gemini models.
## ๐Ÿงก Usage
```typescript
import { createPipelineExecutor, createCollectionFromDirectory, assertsExecutionSuccessful } from '@promptbook/core';
import {
createCollectionFromDirectory,
$provideExecutionToolsForNode,
$provideFilesystemForNode,
} from '@promptbook/node';
import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
import { GoogleExecutionTools } from '@promptbook/google';
// โ–ถ Prepare tools
const fs = $provideFilesystemForNode();
const llm = new GoogleExecutionTools(
// <- TODO: [๐Ÿงฑ] Implement in a functional (not new Class) way
{
isVerbose: true,
apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY,
},
);
const executables = await $provideExecutablesForNode();
const tools = {
llm,
fs,
scrapers: await $provideScrapersForNode({ fs, llm, executables }),
script: [new JavascriptExecutionTools()],
};
// โ–ถ Create whole pipeline collection
const collection = await createCollectionFromDirectory('./books', tools);
// โ–ถ Get single Pipeline
const pipeline = await collection.getPipelineByUrl(`https://promptbook.studio/my-collection/write-article.book.md`);
// โ–ถ Create executor - the function that will execute the Pipeline
const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
// โ–ถ Prepare input parameters
const inputParameters = { word: 'rabbit' };
// ๐Ÿš€โ–ถ Execute the Pipeline
const result = await pipelineExecutor(inputParameters);
// โ–ถ Fail if the execution was not successful
assertsExecutionSuccessful(result);
// โ–ถ Handle the result
const { isSuccessful, errors, outputParameters, executionReport } = result;
console.info(outputParameters);
```
## ๐Ÿง™โ€โ™‚๏ธ Connect to LLM providers automatically
You can just use `$provideExecutionToolsForNode` function to create all required tools from environment variables like `GOOGLE_GENERATIVE_AI_API_KEY` and `OPENAI_API_KEY` automatically.
```typescript
import { createPipelineExecutor, createCollectionFromDirectory, assertsExecutionSuccessful } from '@promptbook/core';
import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
import { $provideExecutionToolsForNode } from '@promptbook/node';
import { $provideFilesystemForNode } from '@promptbook/node';
// โ–ถ Prepare tools
const tools = await $provideExecutionToolsForNode();
// โ–ถ Create whole pipeline collection
const collection = await createCollectionFromDirectory('./books', tools);
// โ–ถ Get single Pipeline
const pipeline = await collection.getPipelineByUrl(`https://promptbook.studio/my-collection/write-article.book.md`);
// โ–ถ Create executor - the function that will execute the Pipeline
const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
// โ–ถ Prepare input parameters
const inputParameters = { word: 'dog' };
// ๐Ÿš€โ–ถ Execute the Pipeline
const result = await pipelineExecutor(inputParameters);
// โ–ถ Fail if the execution was not successful
assertsExecutionSuccessful(result);
// โ–ถ Handle the result
const { isSuccessful, errors, outputParameters, executionReport } = result;
console.info(outputParameters);
```
## ๐Ÿ’• Usage of multiple LLM providers
You can use multiple LLM providers in one Promptbook execution. The best model will be chosen automatically according to the prompt and the model's capabilities.
```typescript
import { createPipelineExecutor, createCollectionFromDirectory, assertsExecutionSuccessful } from '@promptbook/core';
import { $provideExecutionToolsForNode } from '@promptbook/node';
import { $provideFilesystemForNode } from '@promptbook/node';
import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
import { OpenAiExecutionTools } from '@promptbook/openai';
import { GoogleExecutionTools } from '@promptbook/google';
// โ–ถ Prepare multiple tools
const fs = $provideFilesystemForNode();
const llm = [
// Note: ๐Ÿ’• You can use multiple LLM providers in one Promptbook execution.
// The best model will be chosen automatically according to the prompt and the model's capabilities.
new GoogleExecutionTools(
// <- TODO: [๐Ÿงฑ] Implement in a functional (not new Class) way
{
apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY,
},
),
new OpenAiExecutionTools(
// <- TODO: [๐Ÿงฑ] Implement in a functional (not new Class) way
{
apiKey: process.env.OPENAI_API_KEY,
},
),
new AzureOpenAiExecutionTools(
// <- TODO: [๐Ÿงฑ] Implement in a functional (not new Class) way
{
resourceName: process.env.AZUREOPENAI_RESOURCE_NAME,
deploymentName: process.env.AZUREOPENAI_DEPLOYMENT_NAME,
apiKey: process.env.AZUREOPENAI_API_KEY,
},
),
];
const executables = await $provideExecutablesForNode();
const tools = {
llm,
fs,
scrapers: await $provideScrapersForNode({ fs, llm, executables }),
script: [new JavascriptExecutionTools()],
};
// โ–ถ Create whole pipeline collection
const collection = await createCollectionFromDirectory('./books', tools);
// โ–ถ Get single Pipeline
const pipeline = await collection.getPipelineByUrl(`https://promptbook.studio/my-collection/write-article.book.md`);
// โ–ถ Create executor - the function that will execute the Pipeline
const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
// โ–ถ Prepare input parameters
const inputParameters = { word: 'bunny' };
// ๐Ÿš€โ–ถ Execute the Pipeline
const result = await pipelineExecutor(inputParameters);
// โ–ถ Fail if the execution was not successful
assertsExecutionSuccessful(result);
// โ–ถ Handle the result
const { isSuccessful, errors, outputParameters, executionReport } = result;
console.info(outputParameters);
```
## ๐Ÿ’™ Integration with other models
See the other model integrations:
- [OpenAI](https://www.npmjs.com/package/@promptbook/openai)
- [Anthropic Claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)
- [Google Gemini](https://www.npmjs.com/package/@promptbook/google)
- [Vercel](https://www.npmjs.com/package/@promptbook/vercel)
- [Azure OpenAI](https://www.npmjs.com/package/@promptbook/azure-openai)
---

@@ -53,0 +216,0 @@

@@ -24,3 +24,3 @@ (function (global, factory) {

*/
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-5';
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-6';
/**

@@ -767,3 +767,3 @@ * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine

return createExecutionToolsFromVercelProvider(__assign({ title: 'Google', description: 'Implementation of Google models', vercelProvider: googleGeminiVercelProvider, availableModels: [
// TODO: !!!!!! Maybe list models in same way as in other providers
// TODO: [๐Ÿ•˜] Maybe list models in same way as in other providers - in separate file with metadata
'gemini-1.5-flash',

@@ -790,6 +790,2 @@ 'gemini-1.5-flash-latest',

/**
* TODO: [๐Ÿง ][main] !!!! Make anonymous this with all LLM providers
* TODO: [๐Ÿง ][๐Ÿงฑ][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
* TODO: [๐Ÿง ] Maybe auto-detect usage in browser and determine default value of `isProxied`
* TODO: [๐Ÿฆบ] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
* TODO: [๐ŸŽถ] Naming "constructor" vs "creator" vs "factory"

@@ -796,0 +792,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc