Anthropic Models
Big thanks to @waltoss who contributed the Anthropic model support. There are still some TODOs but the basics are in place.
Big thanks to @waltoss who contributed the Anthropic model support. There are still some TODOs but the basics are in place.
GenAIScript defines an agent as a tool that runs an inline prompt to accomplish a task. The agent LLM is typically augmented with additional tools.
In this blog post, we’ll walk through building a user interaction agent
that enables the agent to ask questions to the user.
Let’s dive into understanding how to create an “Agent that can ask questions to the user.”
You can find the full script on GitHub right here.
The script is written in JavaScript. It starts by declaring the metadata to make the script available as a system script, which can be reused in other scripts.
This line sets up the title for our system, making it clear that it’s intended to interact with the user by asking questions.
The defAgent
function defines the behavior of our agent. It takes an agent identifier and a description. These two are quite important,
as they will help the “host” LLM choose to use this agent.
GenAIScript will automatically append a description of all the tools used by the agent prompt so you don’t have to worry about that part in the description.
The third argument is a string or a function to craft prompt instructions for the agent LLM call. The agent implementation already contains generic prompting to make the prompt behave like an agent, but you can add more to specify a role, tone, and dos and don’ts.
The last argument is a set of model options, similar to runPrompt, to configure the LLM call made by the agent. In particular, this is where you list the tools that the agent can use.
The agent is used like any other tool by referencing it in the script
options.
Let’s try the agent with:
and let’s look at the results…
✔ What would be the most unexpected thing to find inside a refrigerator? toaster
✔ Based on your answer, which of the following would also be unexpected to find inside a refrigerator? A television
✔ Is your selection of ‘A television’ the correct unexpected item to find inside a refrigerator? yes
Have you ever found yourself in a situation where you need to search through multiple files in your project, find a specific pattern, and then apply a transformation to it? It can be a tedious task, but fear not! In this blog post, I’ll walk you through a GenAIScript that does just that, automating the process and saving you time. 🕒💡
For example, when GenAIScript added the ability to use a string command string in
the exec
command, we needed to convert all script using
to
The Search And Transform guide covers the detail on this new approach…
We generated a podcast from the help using Google’s NotebookLM (so you don’t have to). Here it is…
In this blog post, we’ll dive into a practical example showcasing how to leverage GenAIScript for automatic web page content analysis. GenAIScript uses the playwright browser automation library which allows to load, interact and inspect web pages.
The following snippet provides a concise and effective way to analyze a web page’s content using GenAIScript:
Let’s break down what each line of this script does:
This line automatically navigates to the specified URL (https://example.com
). The host.browse
function is a powerful feature of GenAIScript that initializes a browser session and returns a page object for further interactions.
Here, the script captures a screenshot of the current view of the page. This is particularly useful for archiving or visual analysis.
After capturing the screenshot, this line registers the image for further analysis. defImages
is a function that makes the screenshot available to subsequent analytical or AI-driven functions in the script.
This command extracts all text content from the page, which can be invaluable for content audits or textual analysis.
The extracted text is then stored under the identifier PAGE_TEXT
, allowing it to be referenced in later parts of the script or for documentation purposes.
Finally, this line represents a call to an AI or script-defined function that analyzes the captured content and provides insights. This is where the real power of automation and AI integration into GenAIScript shines, enabling detailed analysis without manual intervention.
With a simple yet powerful script like the one discussed, GenAIScript makes it feasible to automate the process of web page content analysis. Whether you’re conducting competitive analysis, performing content audits, or simply archiving web pages, GenAIScript offers a scalable and efficient solution.