The Search module for Linguflex enables both text and image search functionalities using the Google Search API.
The Search module offers two main features:
- Text Search: Retrieves real-time information from the internet based on specific search terms.
- Image Search: Searches for images on the web and displays them. This feature is particularly useful for obtaining visual content related to the search terms.
Text Search:
- "Search the internet for the latest space exploration missions."
Image Search:
- "Show me a picture of the Eiffel Tower at night."
Before installing the module, you need two key pieces of information from Google:
- Google API Key: For using the Google Search API.
- Google Custom Search Engine ID (CSE ID): To specify the search engine used for the searches.
The following environment variables must be set:
GOOGLE_API_KEY
GOOGLE_CSE_ID
These are essential for the module to access and use the Google Search API and the Custom Search Engine.
- Visit the Google Cloud Console.
- Create a new project or select an existing one.
- Search for "Custom Search API" and enable it.
- Click "Create Credentials", choose "User data", and proceed.
- Provide application details and select "Web Application" as the application type.
- In the "Credentials" section, create an "API Key".
- Store this key in the
GOOGLE_API_KEY
environment variable or in thesettings.yaml
file.
- Visit Google's Custom Search Engine Site.
- Click "Create a search engine".
- Name the engine and select "Search the entire web".
- After creation, locate the "Search engine ID".
- Store this ID in the
GOOGLE_CSE_ID
environment variable or in thesettings.yaml
file.
As an alternative to setting the environment keys you can also provide the Google API Key and Google Custom Search Engine ID in the settings.yaml
file.
Section: general (at the top)
google_api_key
: Your Google API Key.google_cse_id
: Your Google Custom Search Engine ID.