Skip to content

Commit

Permalink
Merge pull request #238 from griptape-ai:update/serper_search_extension
Browse files Browse the repository at this point in the history
Update/serper_search_extension
  • Loading branch information
shhlife authored Jan 26, 2025
2 parents ebe7b59 + f0ecc7f commit cf6d769
Show file tree
Hide file tree
Showing 50 changed files with 554 additions and 359 deletions.
45 changes: 29 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security -->

## [2.1.15] - 2025-26-01
### Added
- **Griptape Serper Web Driver** based on the Griptape Extension https://github.com/mertdeveci5/griptape-serper-driver-extension.
A driver extension for [Serper.dev] (https://serper.dev/) for web searching functionality. This extension also provides functionality to search for only news, places, images and patents. You can also use a date_range parameter to restrict the search results.

To use the driver, please get a free API key at [Serper.dev](https://serper.dev)
- Added Buttons on most Drivers to open links to the appropriate locations to get API keys. This will hopefully make it easier and more intuitive to grab an API key if you need it for a particular type of service. _Note_: API keys will still need to be added to the Griptape Settings.

### Changed
- Updated Griptape Framework to `1.2.0`
- Elevenlabs library updated from `1.50.4` to `1.50.5`
- Moved examples to [example_workflows](example_workflows/README.md) folder so the examples will show up automatically in **Workflow -> Browse Templates**.

## [2.1.14] - 2025-25-01
### Fixed
- `OllamaPromptDriver` wasn't pulling the default url from settings properly.
Expand All @@ -22,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- The `Create Agent` node now has a `max_subtasks` parameter that will try and help make sure the agent doesn't get caught in an infinite loop of tool use. This is especially useful when you have agents using other agents as tools, and sometimes they get "chatty". If they go back and forth too many times, the run will abort and return the reason why & what the last output was in the thread. This should give you some more control over ensuring you don't have agents running forever.
### Changed
- The [Photographer-Workflow-Comparison-Example](examples/Photographer-Workflow-Comparison-Example.json) has some new rules to try and keep exchanges brief, and also takes advantage of the new `max_subtasks` parameter.
- The [Photographer-Workflow-Comparison-Example](example_workflows/Photographer-Workflow-Comparison-Example.json) has some new rules to try and keep exchanges brief, and also takes advantage of the new `max_subtasks` parameter.

## [2.1.12] - 2025-15-01
### Changed
Expand Down Expand Up @@ -105,8 +118,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [2.0.16] - 2025-02-01
### Added
- [Example](examples/README.md#sorting-a-csv---by-using-generic-python) for using the `Griptape Code: Run Python` node.
![](examples/sort_list_with_python_code.png)
- [Example](example_workflows/README.md#sorting-a-csv---by-using-generic-python) for using the `Griptape Code: Run Python` node.
![](example_workflows/sort_list_with_python_code.png)
### Fixed
- Templates not listed for `Griptape Code: Run Python` node.

Expand Down Expand Up @@ -172,15 +185,15 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.
- Requires an API_KEY from Black Forest Labs (https://docs.bfl.ml/)
- Utilizes new Griptape Extension: https://github.com/griptape-ai/griptape-black-forest

![Black Forest Labs - Create Image](examples/griptape_black_forest_labs_create_image.png)
![Black Forest Labs - Create Image](example_workflows/griptape_black_forest_labs_create_image.png)

- It also works with the `Griptape Create: Image Variation` node.

![Black Forest Labs - Image Variation](examples/griptape_black_forest_labs_create_variation.png)
![Black Forest Labs - Image Variation](example_workflows/griptape_black_forest_labs_create_variation.png)

* `Griptape Create: Image Inpainting Variation` to the Griptape -> Image menu. Gives the ability to paint a mask and replace that part of the image.

![Black Forest Labs - Inpainting](examples/griptape_black_forest_flux_inpainting.png)
![Black Forest Labs - Inpainting](example_workflows/griptape_black_forest_flux_inpainting.png)

### Nov 29, 2024
* Iterating on configuration settings to improve compatibility with ComfyUI Desktop
Expand All @@ -191,7 +204,7 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.

### Nov 27, 2024

* Added example: [PDF -> Profile Pic](examples/pdf_to_profile_pic.png) where a resume in pdf form is summarized, then used as inspiration for an image generation prompt to create a profile picture.
* Added example: [PDF -> Profile Pic](example_workflows/pdf_to_profile_pic.png) where a resume in pdf form is summarized, then used as inspiration for an image generation prompt to create a profile picture.

* Fixed: `gtUIKnowledgeBaseTool` was breaking if a Griptape Cloud Knowledge Base had an `_` in the name. It now handles that situation.

Expand All @@ -200,7 +213,7 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.
* New Nodes:
* `Griptape Create: Image Inpainting Variation` to the Griptape -> Image menu. Gives the ability to paint a mask and replace that part of the image.

![Inpainting](examples/inpainting.png)
![Inpainting](example_workflows/inpainting.png)

* `Griptape Run: Task` - Combines/Replaces `Griptape Run: Prompt Task`, `Griptape Run: Tool Task`, and `Griptape Run Toolkit Task` into a single node that knows what to do.
* `Griptape Run: Text Extraction` to the Griptape -> Text menu
Expand All @@ -210,11 +223,11 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.
* Updated `Griptape RAG Retrieve: Text Loader Module` to take a file input or text input.
* Fixed ExtractionTool to use a default of `gpt-4o-mini`
* Added some text files for testing text loading
* Added Examples to [Examples Readme](examples/README.md)
* [Render Log Review](examples/render_log_review.png)
* [Flux Pro 1.1 Image Generation](examples/griptape_black_forest_labs_create_image.png)
* [Flux Pro 1.0-Canny Image Variation](examples/griptape_black_forest_labs_create_variation.png)
* [Flux Pro 1.0-Fill Image InPainting](examples/griptape_black_forest_flux_inpainting.png)
* Added Examples to [Examples Readme](example_workflows/README.md)
* [Render Log Review](example_workflows/render_log_review.png)
* [Flux Pro 1.1 Image Generation](example_workflows/griptape_black_forest_labs_create_image.png)
* [Flux Pro 1.0-Canny Image Variation](example_workflows/griptape_black_forest_labs_create_variation.png)
* [Flux Pro 1.0-Fill Image InPainting](example_workflows/griptape_black_forest_flux_inpainting.png)

### Nov 9, 2024
* Upgrade to Griptape Framework v0.34.2
Expand Down Expand Up @@ -280,7 +293,7 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.
* `Griptape Util: Create Model from Modelfile`. Given a Modelfile, create a new Ollama model.
* `Griptape Util: Remove Ollama Model`. Given an Ollama model name, remove the model from Ollama. This will help you cleanup unnecessary models. _Be Careful with this one, as there is no confirmation step!_

![Create New Model](examples/createNewModel.png)
![Create New Model](example_workflows/createNewModel.png)

### Sept 5, 2024
**MAJOR UPDATE**
Expand All @@ -297,7 +310,7 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.
* New Nodes
* `Griptape Agent Config: Cohere Drivers`: A New Cohere node.
* `Griptape Agent Config: Expand`: A node that lets you expand Config Drivers nodes to get to their individual drivers.
* `Griptape RAG Nodes` a whole new host of nodes related to Retrieval Augmented Generation (RAG). I've included a sample in the [examples](examples/retrieval_augmented_generation.json) folder that shows how to use these nodes.
* `Griptape RAG Nodes` a whole new host of nodes related to Retrieval Augmented Generation (RAG). I've included a sample in the [examples](example_workflows/retrieval_augmented_generation.json) folder that shows how to use these nodes.

The new nodes include:
* `Griptape RAG: Tool` - A node that lets you create a tool for RAG.
Expand Down Expand Up @@ -399,7 +412,7 @@ Entries below were recorded before moving to this new `CHANGELOG.md` method.

* **Environment Variables parameters** - all nodes that require environmetn variables & api keys have those environment variables specified on the nodes. This should make it easier to know what environment variables you want to set in `.env`.

* **Examples** - Example workflows are now available in the `/examples` folder [here](examples/README.md).
* **Examples** - Example workflows are now available in the `/examples` folder [here](example_workflows/README.md).

* **Breaking Change**
* There is no longer a need for an `ImageQueryDriver`, so the `image_query_model` input has been removed from the configuration nodes.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The following image is a workflow you can drag into your ComfyUI Workspace, demo

## More examples

You can previous and download more examples [here](examples/README.md).
You can previous and download more examples [here](example_workflows/README.md).

## Using the nodes - Video Tutorials
1. Installation: https://youtu.be/L4-HnKH4BSI?si=Q7IqP-KnWug7JJ5s
Expand Down
4 changes: 4 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@
# - Redis
from .nodes.drivers.gtUIRedisVectorStoreDriver import gtUIRedisVectorStoreDriver

# - Serper
from .nodes.drivers.gtUISerperWebSearchDriver import gtUISerperWebSearchDriver

# - Tavily
from .nodes.drivers.gtUITavilyWebSearchDriver import gtUITavilyWebSearchDriver

Expand Down Expand Up @@ -408,6 +411,7 @@
"Griptape WebSearch Driver: DuckDuckGo": gtUIDuckDuckGoWebSearchDriver,
"Griptape WebSearch Driver: Exa": gtUIExaWebSearchDriver,
"Griptape WebSearch Driver: Google": gtUIGoogleWebSearchDriver,
"Griptape WebSearch Driver: Serper": gtUISerperWebSearchDriver,
"Griptape WebSearch Driver: Tavily": gtUITavilyWebSearchDriver,
# AGENT RULES
"Griptape Create: Rules": gtUIRule,
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions js/apiKeyButtons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {
gtUIAddUploadWidget,
gtUIAddUrlButtonWidget,
gtUIAddButtonWidget,
} from "./gtUIUtils.js";
const API_PROVIDERS = {
Anthropic: { url: "https://console.anthropic.com/settings/keys" },
Amazon: {
url: "https://console.aws.amazon.com/iam/home?#/security_credentials",
},
Azure: { url: "https://portal.azure.com/" },
"Black Forest Labs": { url: "https://api.us1.bfl.ai/auth/profile" },
Cohere: { url: "https://dashboard.cohere.com/api-keys" },
ElevenLabs: { url: "https://elevenlabs.io/app/settings/api-keys" },
Google: { url: "https://console.cloud.google.com/apis/credentials" },
LeonardoAI: { url: "https://app.leonardo.ai/api-access" },
Groq: { url: "https://console.groq.com/keys" },
Serper: { url: "https://serper.dev/api-key" },
OpenAI: { url: "https://platform.openai.com/account/api-keys" },
HuggingFace: { url: "https://huggingface.co/settings/tokens" },
"LM Studio": {
url: "https://lmstudio.ai/",
buttonText: "Download LM Studio",
},
Ollama: {
url: "https://ollama.com",
buttonText: "Download Ollama",
},
Voyage: {
url: "https://dashboard.voyageai.com/api-keys",
},
Tavily: {
url: "https://app.tavily.com/",
},
Exa: { url: "https://dashboard.exa.ai/api-keys" },
Pinecone: { url: "https://app.pinecone.io/keys" },
Qdrant: { url: "https://cloud.qdrant.io" },
};

export function setupApiKeyButtons(nodeType, nodeData, app) {
const providerName = Object.keys(API_PROVIDERS).find((provider) =>
nodeData.name.includes(provider)
);

if (providerName) {
const provider = API_PROVIDERS[providerName];
const buttonText = provider.buttonText || `Get ${providerName} API Key`;

gtUIAddUrlButtonWidget(nodeType, buttonText, provider.url, "");
}
}
23 changes: 12 additions & 11 deletions js/griptape_api_keys.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export const keys_organized = {
"!Griptape": ["GRIPTAPE_CLOUD_API_KEY"],
"OpenAI": ["OPENAI_API_KEY"],
"Amazon": [
OpenAI: ["OPENAI_API_KEY"],
Amazon: [
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"AWS_DEFAULT_REGION",
"AMAZON_OPENSEARCH_HOST",
"AMAZON_OPENSEARCH_INDEX_NAME",
],
"Anthropic": ["ANTHROPIC_API_KEY"],
Anthropic: ["ANTHROPIC_API_KEY"],
"BlackForest Labs": ["BFL_API_KEY"],

"Microsoft Azure": [
Expand All @@ -17,13 +17,14 @@ export const keys_organized = {
"AZURE_OPENAI_DALL_E_3_API_KEY",
"AZURE_OPENAI_API_KEY",
],
"Cohere": ["COHERE_API_KEY"],
Cohere: ["COHERE_API_KEY"],
"Eleven Labs": ["ELEVEN_LABS_API_KEY"],
"Exa": ["EXA_API_KEY"],
"Groq": ["GROQ_API_KEY"],
"Google": ["GOOGLE_API_KEY", "GOOGLE_API_SEARCH_ID"],
"Huggingface": ["HUGGINGFACE_HUB_ACCESS_TOKEN"],
"LeonardoAI": ["LEONARDO_API_KEY"],
"Pinecone": ["PINECONE_API_KEY", "PINECONE_ENVIRONMENT", "PINECONE_INDEX_NAME"],
"Tavily": ["TAVILY_API_KEY"],
Exa: ["EXA_API_KEY"],
Groq: ["GROQ_API_KEY"],
Google: ["GOOGLE_API_KEY", "GOOGLE_API_SEARCH_ID"],
Huggingface: ["HUGGINGFACE_HUB_ACCESS_TOKEN"],
LeonardoAI: ["LEONARDO_API_KEY"],
Pinecone: ["PINECONE_API_KEY", "PINECONE_ENVIRONMENT", "PINECONE_INDEX_NAME"],
Tavily: ["TAVILY_API_KEY"],
Serper: ["SERPER_API_KEY"],
};
37 changes: 27 additions & 10 deletions js/gtUINodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ import { setupDisplayNodes } from "./DisplayNodes.js";
import { setupCombineNodes } from "./CombineNodes.js";
import { setupExtractionNodes } from "./ExtractionNodes.js";
import { setupTextLoaderModuleNodes } from "./TextLoaderModuleNodes.js";
import { gtUIAddUploadWidget, gtUIAddUrlButtonWidget, gtUIAddButtonWidget } from "./gtUIUtils.js";
import {
gtUIAddUploadWidget,
gtUIAddUrlButtonWidget,
gtUIAddButtonWidget,
} from "./gtUIUtils.js";
import { setupMenuSeparator } from "./gtUIMenuSeparator.js";
import { keys_organized } from "./griptape_api_keys.js";
import { setupVisibilityToggles } from "./NodesWithVisibilityToggles.js";
import { setupCodeExecutionNode } from "./CodeExecutionNode.js";
import { setupCodeExecutionNode } from "./CodeExecutionNode.js";
import { setupApiKeyButtons } from "./apiKeyButtons.js";
import { createSettings } from "./settings.js";
const createUrlCallback = function(url) {
return function() {
window.open(url, "_blank"); // Opens the provided URL in a new tab
const createUrlCallback = function (url) {
return function () {
window.open(url, "_blank"); // Opens the provided URL in a new tab
};
}
};

function addGriptapeTopBarButtons() {
const buttons = [];
Expand All @@ -29,7 +34,7 @@ function addGriptapeTopBarButtons() {
app,
enabled: true,
classList: "comfyui-button comfyui-menu-mobile-collapse primary",
});
});
console.log(griptapeButton);
}
app.registerExtension({
Expand Down Expand Up @@ -102,7 +107,7 @@ app.registerExtension({
setupExtractionNodes(nodeType, nodeData, app);
setupVisibilityToggles(nodeType, nodeData, app);
setupCodeExecutionNode(nodeType, nodeData, app);

setupApiKeyButtons(nodeType, nodeData, app);
// Create Audio Node
if (nodeData.name === "Griptape Load: Audio") {
gtUIAddUploadWidget(nodeType, nodeData, "audio", "audio");
Expand All @@ -116,9 +121,21 @@ app.registerExtension({
}
setupTextLoaderModuleNodes(nodeType, nodeData, app);

// if (nodeData.name === "Griptape WebSearch Driver: Serper") {
// gtUIAddUrlButtonWidget(
// nodeType,
// "Get Serper API Key",
// "https://serper.dev/api-key",
// ""
// );
// }
if (nodeData.name === "Griptape Code: Run Griptape Cloud Structure") {
gtUIAddUrlButtonWidget(nodeType, "Open Griptape Cloud Structure Dashboard", "https://cloud.griptape.ai/structures", "structure_id")
gtUIAddUrlButtonWidget(
nodeType,
"Open Griptape Cloud Structure Dashboard",
"https://cloud.griptape.ai/structures",
"structure_id"
);
}

},
});
Loading

0 comments on commit cf6d769

Please sign in to comment.