Skip to content

Answer

Get an answer to a question based on web sources with citations.

Playground

Description

Use the /answer endpoint to perform a research task using the web as context.

  • Receive a response to a question by scraping the web for the most relevant information.
  • The fast mode only inspects page summaries for providing the answer.
  • To get more detailed answers, use the deep mode. It will inspect full web page contents.

Arguments

query: str - the question to ask

domain: str - restrict search to domain, e.g., wikipedia.org.

mode: enum - the web research mode

  • fast: inspect only page summaries for faster response
  • deep: scrape full web page contents for more detailed response

Usage

python
import requests
import json

api_key = 'YOUR_API_KEY'

payload = json.dumps({
  'query': 'who were the founders of apple?',
  'mode': 'fast'
})
headers = {'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json'}

response = requests.post('https://api.ivycheck.com/v1/answer', headers=headers, data=payload)

print(response.text)
bash
curl -X POST "https://api.ivycheck.com/v1/answer" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "query": "who were the founders of apple?",
  "mode": "fast"
}'
js
const url = 'https://api.ivycheck.com/v1/answer';
const apiKey = 'YOUR_API_KEY';

fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer " + apiKey,
  },
  body: JSON.stringify({{
  'query': 'who were the founders of apple?',
  'mode': 'fast'
}),
})
.then(response => response.text())
.then(data => console.log(data));
js
const axios = require("axios");
const url = "https://api.ivycheck.com/v1/answer";
const apiKey = "YOUR_API_KEY";

axios
  .post(
    url,
    {
      query: "who were the founders of apple?",
      mode: "fast",
    },
    {
      headers: {
        "Content-Type": "application/json",
        Authorization: "Bearer " + apiKey,
      },
    }
  )
  .then((response) => console.log(response.data))
  .catch((error) => console.error(error));

Response Example

json
{
  "response": {
    "answer": "Apple Computer, Inc. was founded on April 1, 1976, by three individuals: Steve Jobs, Steve Wozniak, and Ronald Wayne. However, Ronald Wayne left the company just 12 days after its founding and sold his share of the company back to Jobs and Wozniak for $800. Therefore, the primary founders of Apple are often considered to be Steve Jobs and Steve Wozniak [1](https://guides.loc.gov/this-month-in-business-history/april/apple-computer-founded)[2](https://en.wikipedia.org/wiki/Apple_Inc.).\n\nSteve Jobs and Steve Wozniak, who were college dropouts at the time, brought a vision of changing the way people viewed computers. They wanted to make computers small enough for people to have them in their homes or offices, and they wanted a computer that was user-friendly [1](https://guides.loc.gov/this-month-in-business-history/april/apple-computer-founded).\n\nMike Markkula, a multimillionaire, provided essential business expertise and funding of $250,000 to Jobs and Wozniak during the incorporation of Apple [2](https://en.wikipedia.org/wiki/Apple_Inc.).",
    "sources": [
      {
        "id": 1,
        "title": "The Founding of Apple Computer, Inc. - This Month in Business History",
        "link": "https://guides.loc.gov/this-month-in-business-history/april/apple-computer-founded"
      },
      {
        "id": 2,
        "title": "Apple Inc. - Wikipedia",
        "link": "https://en.wikipedia.org/wiki/Apple_Inc."
      }
    ]
  },
  "success": true,
  "credits": 5,
  "error": null
}