Skip to content

Steamship Plugin to get answers for queries via GoogleSearch

Notifications You must be signed in to change notification settings

steamship-core/serpapi-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SerpAPI Wrapper Plugin

This project implements a basic Steamship Tagger that provides answers to queries using Google Search (via the SerpAPI).

In Steamship, Taggers add annotations to text that can be queried and composed later.

Once a Tagger has generated data in Steamship, that data is ready for use by the rest of the ecosystem. For example, you could use the tags generated by this plugin to implement the self-ask-with-search prompting pattern.

First Time Setup

We recommend using Python virtual environments for development. To set one up, run the following command from this directory:

python3 -m venv .venv

Activate your virtual environment by running:

source .venv/bin/activate

Your first time, install the required dependencies with:

python -m pip install -r requirements.dev.txt
python -m pip install -r requirements.txt

Developing

All the code for this plugin is located in the src/api.py file.

Testing

Tests are located in the test/test_integration.py file. You can run them with:

pytest

Deploying

Deploy by running:

ship deploy

That will deploy your plugin to Steamship and register it as a plugin for use.

Using

Once deployed, your Plugin can be referenced by the handle in your steamship.json file.

from steamship import Steamship, Block, File, MimeTypes, Tag

MY_PLUGIN_HANDLE = "... fill this out ..."

with Steamship.temporary_workspace() as client:
    search = client.use_plugin(MY_PLUGIN_HANDLE)
    task = search.tag(doc="How old was Abraham Lincoln when he died?")
    task.wait()
    for block in task.output.file.blocks:
        for tag in block.tags:
            print(tag)

Feedback

Questions, comments, suggestions, etc. are all welcome, either via [email protected] or our Discord.

We would love take a look, hear your suggestions, help where we can, and share what you've made with the community.

About

Steamship Plugin to get answers for queries via GoogleSearch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages