Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endeble IA de Brave v1.0.path #45

Closed
DawallAZllon91 opened this issue May 1, 2024 · 0 comments · Fixed by #54 or #52
Closed

Endeble IA de Brave v1.0.path #45

DawallAZllon91 opened this issue May 1, 2024 · 0 comments · Fixed by #54 or #52

Comments

@DawallAZllon91
Copy link
Owner

Endpoints
Brave Search API exposes multiple endpoints for specific types of data, based on the level of your subscription. If you don’t see the endpoint you’re interested in, you may need to change your subscription.

Brave Web Search API
Brave Web Search API is currently available at the following endpoint and exposes an API to query general web.

Endpoint

https://api.search.brave.com/res/v1/web/search
Get started immediately with CURL. An example request will look something like this:

Curl

curl -s --compressed "https://api.search.brave.com/res/v1/web/search?q=brave+search" -H "Accept:
application/json" -H "Accept-Encoding: gzip" -H "X-Subscription-Token: <YOUR_API_KEY>"
The response specification for Web Search API can be seen in the WebSearchApiResponse model.

Brave Summarizer Search API

Note
Access to summarizer is available through the Pro AI plan.
Brave Summarizer Search API is currently available at the following endpoint and exposes an API to get summarized content for web search queries.

Endpoint

https://api.search.brave.com/res/v1/summarizer/search
To utilize the Summarizer, follow the steps outlined below.

An initial request has to be made to web search endpoint with a given query. An example request is given below.

Curl

curl -s --compressed "https://api.search.brave.com/res/v1/web/search?q=what+is+the+second+highest+mountain&summary=1" -H
"Accept: application/json" -H "Accept-Encoding: gzip" -H "X-Subscription-Token:
<YOUR_API_KEY>"
If the query is eligible for a summary or an answer, as in this case, a summarizer key is provided in the response.

Note

The summarizer API version 2023-08-25 is deprecated. Please use the version 2024-04-23 onwards.
For API version 2024-04-23 onwards, the key is equal to summarizer key (key) as part of the (Summarizer) response model. An example is below.

Response

{"summarizer": {"type": "summarizer", "key": "{"query":"what is the second highest mountain","country":"us","language":"en","safesearch":"moderate","results_hash":"a51e129180225a2f4fe1a00984bcbf58f0ae0625c97723aae43c2c6e3440715b"}}
Note
The key should be treated as a string and passed as is. The format can change in the future.
The key can be used to poll the summarizer endpoint for the summarized content. Requests to summarizer are not counted towards your plan and only the initial request to web search endpoint is billed based on the selected plan. An example request is below.

Curl

curl -s --compressed "https://api.search.brave.com/res/v1/summarizer/search?key=%7B%22query%22%3A%22what%20is%20the%20second%20highest%20mountain%22%2C%22country%22%3A%22us%22%2C%22language%22%3A%22en%22%2C%22safesearch%22%3A%22moderate%22%2C%22results_hash%22%3A%22a51e129180225a2f4fe1a00984bcbf58f0ae0625c97723aae43c2c6e3440715b%22%7D&entity_info=1" -H "accept: application/json" -H "Accept-Encoding: gzip" -H "x-subscription-token: <YOUR_API_KEY>"

For API version 2023-08-25, the key is equal to summarizer key (summary_key) which is provided in the response to a web search query when it is eligible for a summary or an answer. The key is part of the query (Query) response model. API version 2023-08-25 is now deprecated. An example is below.

Response

{"query": {"summary_key": "what is the second highest mountain:us:en"}}

This key can be used to poll the summarizer endpoint for the summarized content. Polling requests to summarizer endpoint are not counted towards your plan and only the initial request to web search endpoint is billed based on the selected plan. An example poll request is below.

Curl

curl -s --compressed "https://api.search.brave.com/res/v1/summarizer/search?key=what%20is%20the%20second%20highest%20mountain:us:en"
-H "Accept: application/json" -H "Accept-Encoding: gzip" -H "X-Subscription-Token:
<YOUR_API_KEY>"
Note
The summarizer results are cached for a limited time, after which the flow has to be started again to get the summarized content.
The response specification for Summarizer Search API can be seen in the SummarizerSearchApiResponse model.

Repository owner locked and limited conversation to collaborators May 1, 2024
@DawallAZllon91 DawallAZllon91 closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
@DawallAZllon91 DawallAZllon91 linked a pull request May 2, 2024 that will close this issue
@DawallAZllon91 DawallAZllon91 linked a pull request Jul 12, 2024 that will close this issue
Repository owner unlocked this conversation Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment