AI Search Engine
Last updated
Was this helpful?
Last updated
Was this helpful?
AI Web Search Engine is designed to retrieve real-time information from the internet. This solution processes user queries and return relevant data from various online sources, making them useful for tasks that require up-to-date knowledge beyond static datasets. It supports two usage options:
Using six specialized API endpoints, each designed to search for only one specific type of information. These endpoints return structured responses, making them more suitable for integration into specialized services (e.g., a weather widget). Here are the types of information you can retrieve this way:
See API references and examples on the subpages.
As a general chat completion solution (but searching on the internet): enter a query in the prompt and receive an internet-sourced answer, similar to asking a question on a search engine through a browser. See the API Schema below or check how this call is made in the Python example on the bottom of this page.
Check how this call is made in the examples below.
Note that queries can include advanced search syntax:
Search for an exact match: Enter a word or phrase using \"
before and after it.
For example, \"tallest building\"
.
Search for a specific site: Enter site:
in front of a site or domain.
For example, site:youtube.com cat videos
.
Exclude words from your search: Enter -
in front of a word that you want to leave out.
For example, jaguar speed -car
.
You can also personalize the AI Search Engine output by passing the ip
parameter.
See Example #2 below.
When using regular search engines in browsers, we can simply ask, 'Weather today' without specifying our location. In this case, the search engine automatically uses your IP address to determine your location and provide a more relevant response. The AI Search Engine also supports IP-based personalization.
In the example below, the query does not specify a city, but since the request includes an IP address registered in Stockholm, the system automatically adjusts, and the response will contain today's weather forecast for that city.
Note that when making a request via Python, the ip
parameter should be included inside the extra_body
parameter (see example below). When using other languages, this is not required, and the ip
parameter can be passed like any other parameter.
Keep in mind that the system caches the IP address for a period of two weeks. This means that after specifying an IP address once, any queries without an explicit location will continue to return responses linked to Stockholm for the next two weeks, even if you don't include the IP address in subsequent requests. If you need to change the location, simply provide a new IP address in your next request.
If an IP address registered in one location is used while explicitly specifying a different location in the query, AI Search Engine will prioritize the location from the query:
Creates a chat completion using a language model, allowing interactive conversation by predicting the next response based on the given chat history. This is useful for AI-driven dialogue systems and virtual assistants.
bagoodex/bagoodex-search-v1
If true, the new message will be prepended with the last message if they belong to the same role.
If true, the generation prompt will be added to the chat template. This is a parameter used by chat template in tokenizer config of the model.
If true, special tokens (e.g. BOS) will be added to the prompt on top of what is added by the chat template. For most models, the chat template takes care of adding the special tokens so this should be set to False (as is the default).
A list of dicts representing documents that will be accessible to the model if it is performing RAG (retrieval-augmented generation). If the template does not support RAG, this argument will have no effect. We recommend that each document should be a dict containing "title" and "text" keys.
A Jinja template to use for this conversion. If this is not passed, the model's default chat template will be used instead.
Additional kwargs to pass to the template renderer. Will be accessible by the chat template
Whether to include the stop string in the output. This is only applied when the stop or stop_token_ids is set
If specified, the output will follow the JSON schema.
If specified, the output will follow the regex pattern.
If specified, the output will be exactly one of the choices.
If specified, the output will follow the context free grammar.
If specified, will override the default guided decoding backend of the server for this specific request. If set, must be either 'outlines' / 'lm-format-enforcer'
outlines
, lm-format-enforcer
If specified, will override the default whitespace pattern for guided json decoding.
IP from which a request is executed
No body