Contextual Answers [Single Document]

Receives a document and a question and returns an answer based entirely on the document context.

Having trouble with language models that provide false information with high confidence? Would you like answers solely based on your document context? Well, we have just the thing for you! The AI21 Studio /answer API allows you to access our high-quality question answering technology. It was designed to answer questions based on a specific document context provided by the customer. This avoids any factual issues that language models may have and makes sure the answers it provides are grounded in that context document.

Don’t just take our word for it, give it a go! 💫

Whether you're an NLP enthusiast or have no prior knowledge, this API is for you. There are many clever mechanisms under the hood, but you don't have to understand them (if you don't want to). As a task-specific API, you can easily integrate it into your systems and get a high-quality, grounded question answering mechanism in a matter of minutes, with no prompt engineering required. Additionally, since it's optimized for this purpose, it's significantly more efficient than building it from scratch, and an order of magnitude more affordable.

This API receives document text, serving as a context, and a question and returns an answer based entirely on this context. This means that if the answer to your question is not in the document, the model will indicate it (instead of providing a false answer).

Features

It’s all about the context

No matter what you ask, the answer will only be determined by the document context. Imagine you are performing research and rely on financial reports to base your findings. Let's take the following part from JPMorgan Chase & Co. 2021 annual report:

Document context
In 2020 and 2021, enormous QE — approximately $4.4 trillion, or 18%, of 2021 gross domestic product (GDP) — and enormous fiscal stimulus (which has been and always will be inflationary) — approximately $5 trillion, or 21%, of 2021 GDP — stabilized markets and allowed companies to raise enormous amounts of capital. In addition, this infusion of capital saved many small businesses and put more than $2.5 trillion in the hands of consumers and almost $1 trillion into state and local coffers. These actions led to a rapid decline in unemployment, dropping from 15% to under 4% in 20 months — the magnitude and speed of which were both unprecedented. Additionally, the economy grew 7% in 2021 despite the arrival of the Delta and Omicron variants and the global supply chain shortages, which were largely fueled by the dramatic upswing in consumer spending and the shift in that spend from services to goods. Fortunately, during these two years, vaccines for COVID-19 were also rapidly developed and distributed.
In today's economy, the consumer is in excellent financial shape (on average), with leverage among the lowest on record, excellent mortgage underwriting (even though we've had home price appreciation), plentiful jobs with wage increases and more than $2 trillion in excess savings, mostly due to government stimulus. Most consumers and companies (and states) are still flush with the money generated in 2020 and 2021, with consumer spending over the last several months 12% above pre-COVID-19 levels. (But we must recognize that the account balances in lower-income households, smaller to begin with, are going down faster and that income for those households is not keeping pace with rising inflation.)
Today's economic landscape is completely different from the 2008 financial crisis when the consumer was extraordinarily overleveraged, as was the financial system as a whole — from banks and investment banks to shadow banks, hedge funds, private equity, Fannie Mae and many other entities. In addition, home price appreciation, fed by bad underwriting and leverage in the mortgage system, led to excessive speculation, which was missed by virtually everyone — eventually leading to nearly $1 trillion in actual losses.

Rather than reading the entire report, just ask what you want to know:

Question
Did the economy shrink after the Omicron variant arrived?
Answer
No, the economy grew 7% in 2021, despite the arrival of the Delta and Omicron variants and the global supply chain shortages.

In addition, you can ask more complex questions, where the answer requires deductions rather than just extracting the correct sentence from the document context. This will result in abstractive, rather than extractive, answers that draw on several different parts of the document. For example, look at the following question:

Question
Did COVID-19 eventually help the economy?
Answer
The dramatic rise in consumer spending and the shift in that spend from services to goods, along with QE and fiscal stimulus, helped to stimulate the economy.

The answer is not in the document? You got your answer then

When working with these types of models, the main concern is that they will give you a made-up answer that is neither 100% accurate nor grounded in your provided text. Our Contextual Answers API prevents this from happening.

Using the same document text as above, we present the model with the following question. You may be confused to answer something based on the last paragraph without delving into the text. However, if you read the provided document context properly, you will discover that the answer does not appear there. The API will handle this as expected:

Question
How did COVID-19 affect the financial crisis of 2008?
Answer
Answer not in document

Example - documentation Q&A

This API is very useful when working with large amounts of internal data, such as organization documents. You can build a system that provides all the information a user needs without having to read long and tedious documents, knowing that the answers are reliable.

You've probably heard of RTFM (Read The Friendly Manual). However, sometimes the manual may not be as friendly as you would like. By integrating this API into your system, your users can ask questions without needing to search. As an example, here is one from Wikipedia docs:

Content
Further information: Wikipedia:Policies and guidelines § Not part of the encyclopedia, and Wikipedia:Be bold § Wikipedia namespace
See also: Wikipedia:User pages § What may I not have in my user pages?
Pages within the "Project namespace" themselves are not part of the encyclopedia proper. These administrative pages are intended for use by editors or by automated tools for the organization and governance of the encyclopedia. Consequently, they do not generally need to conform to the same content protocols or style conventions as articles. Nevertheless, these pages, as with all pages, should be accessible and must comply with Wikipedia's conduct and legal policies.

The project namespace is not a free web host and should not be used as a long-term archive to host pages that look like articles. Articles in the project namespace under construction may be moved to the draft namespace or Userspace draft allowing time for their development and feedback before being moved to Wikipedia's mainspace. Stalled or abandoned drafts and pages in the project namespace that violate policies applicable to non-content pages may be subject to deletion. Editors may not violate copyrights or harass anywhere on Wikipedia. Under the criteria for speedy deletion, these types of pages are subject to expeditious deletion. See below for more information.

Pages within project namespace
The project namespace pages are organized according to their function within the overall project schema. This includes Wikipedia official policies and guidelines, process pages, discussion pages, optional essays, maintenance pages, informative pages, and historical pages.

For lists of pages in the project namespace, see:

Wikipedia:Directories and indexes – a handy list of Wikipedia's directories and indexes.
Wikipedia:Department directory – a list of the different administrative divisions of Wikipedia.
Wikipedia:Editor's index to Wikipedia – an enormous list of the Wikipedia community, intended to help find anything not in the encyclopedia itself.
A main gateway for the project namespace is Community portal. The Community Portal includes categorized links to the more commonly used pages related to the project. A link to the Community Portal page is available in the sidebar.

Policies and guidelines pages
Policies and guidelines pages describe Wikipedia's best practice and clarify principles that are widely accepted by the community and have been through the Wikipedia review process. These pages are marked with the {{policy}}, {{guideline}} or {{MoS guideline}} template. For summaries of key policies, see List of policies. For summaries of key guidelines, see List of guidelines. For summaries of guidelines about Wikipedia's house style, see the Manual of Style contents page. For information on editing policies or guidelines see Edits to policies and guidelines.

Category:Wikipedia policies – contains important rules that are widely accepted and procedures for important processes such as deletion; there are relatively few of those.
Category:Wikipedia guidelines – contains consensual rules-of-thumb that are not strict, but are considered by most editors to be useful most of the time.
Category:Wikipedia Manual of Style – contains style guidelines widely accepted among editors.
Process pages
Process pages help facilitate application of the policies and guidelines governing all Wikipedia pages (e.g., Wikipedia:Articles for deletion). See Wikipedia processes for details.

Category:Wikipedia processes
Information and discussions
Many pages in the Wikipedia namespace have nothing to do with rules or implementation of those rules, and thus do not belong in the above categories. See Wikipedia:The difference between policies, guidelines and essays for more information.

Discussion and noticeboard pages
Some pages are designed for discussions, such as the Village pumps. Others serve as noticeboards to draw attention to discussions taking place elsewhere, such as the centralized discussions page and various requests for comments pages. While many of these pages operate like talk pages, some of them have posting rules (at the top of the page) which may be administratively enforced, and they also have their own talk pages, usually about the management of the noticeboard or other process in question. To ask a question or make a request, see the request directory. For a listing of ongoing discussions and current requests, see the dashboard.

Category:Wikipedia discussion
Category:Wikipedia noticeboards
Category:Wikipedia requests
Maintenance pages
Maintenance pages are used to help facilitate the organization and clean-up of articles to bring them up to encyclopedic standards. These editor- and bot-generated pages typically contain articles and other pages requiring maintenance or attention. (e.g., Wikipedia:Dusty articles). The Special namespace also contains bot generated maintenance reports (e.g. Special:UncategorizedPages). See Wikipedia maintenance for details.

Category:Wikipedia maintenance
Special:SpecialPages
How-to and information pages
Informative and instructional pages are typically edited by the community; while not policies or guidelines themselves, they are intended to supplement or clarify Wikipedia guidelines, policies, or other Wikipedia processes and practices that are communal norms. Where essay pages offer advice or opinions through viewpoints, information pages should supplement or clarify technical or factual information about Wikipedia impartially. In comparison to policies and guidelines, information pages, like essay pages, have a limited status, and can reflect varying levels of consensus and vetting. These pages are typically marked with the {{Information page}}, {{Wikipedia how-to}}, or {{Supplement}}[a] template.

There is a large amount of overlap between the Help namespace (which provides mainly technical information) and the Wikipedia namespace (which provides mainly procedural information and interpretation). For this reason, redirects and hatnotes are often set up between these two namespaces. See Help:About help pages for more information. For a listing of how-to and information pages, see the help directory.

Category:Wikipedia information pages
Category:Wikipedia how-to
Category:Wikipedia supplemental pages
Essay pages
Essays about Wikipedia may be written by anyone; some represent widespread norms, others only represent minority viewpoints. Essays can be long monologues or short theses , serious or funny, informative or opinionated. Essays like information pages have no official status, and do not speak for the Wikipedia community as they may be created and edited without overall community oversight. Essays are typically marked with one of the various {{essay}} templates. See Wikipedia:Essays for more information. For a listing of essays, see the essay directory.

Category:Wikipedia essays
WikiProject pages
Pages of a WikiProject are the central place for editor collaboration and organization on a particular topic area. Many WikiProjects compose "advice essays" about how to apply Wikipedia's policies and guidelines to their specific subject area. Pages with Wikipedia:WikiProject prefix form a WikiProject pseudo-namespace. These pages are typically marked with the {{WikiProject status}} or {{WikiProject advice}} template. For a listing of projects, see the directory of WikiProjects. For additional resources, or if you have any questions, please visit the WikiProject Council.

Category:WikiProjects
Historical pages
See also: Wikipedia:Policies and guidelines § historical
A historical page or process is one which is no longer in use, or is no longer relevant or consensus has changed about its content. They are kept as records of past Wikipedia processes to give context to historical discussions and to inform future discussions on similar topics. These pages are typically marked with the {{historical}}, {{superseded}} or {{dormant}} templates. See HISTORICAL for more details.

Category:Wikipedia history
Wikipedia:Historical archive
Wikipedia:History of Wikipedian processes and people
Creating new project pages
Further information: Wikipedia:Avoid writing redundant essays and Wikipedia:Content forking/Internal § Policy forks
See also: Wikipedia:User pages § What may I have in my user pages?, and Wikipedia:Drafts § Creating and editing drafts
Essays and information pages may be established by writing them and adding {{Essay}}, {{Information page}}, {{Wikipedia how-to}}, or similar templates to the page. Essays and information pages in the "Wikipedia namespace" should not be used to create an alternative rule set. Creation of new guideline and policy pages require discussion and a high level of consensus from the entire community before publication (see WP:PROPOSAL for procedural details). For general recommendations about the creation and improvement of existing guideline and policy pages, see Wikipedia:Policy writing is hard.

The project namespace contains many pages and a lot of information. Try to avoid creating new pages unnecessarily. Before creating a new page, you should consider looking through the topical index, essay directory and help directory to see if the material belongs at a page that already exists. It is strongly recommended that you propose a WikiProject at the proposal page, if there are enough willing editors to participate in the project. Already existing WikiProjects can be found in the directory of WikiProjects.

Deletion of project pages
Main page: Wikipedia:Miscellany for deletion
See also: Wikipedia:User pages § Deletion of user pages, and Wikipedia:Drafts § Deleting a draft
Iif editing can improve the page, this should be done rather than deleting the page. Disputes over page content are usually not dealt with by deleting the page, except in severe cases. The content issues should be discussed at the relevant talk page, and other methods of dispute resolution should be used first, such as listing on "requests for comments" for further input.

The usual deletion process is to post a request at miscellany for deletion to have project pages deleted. Make sure that a notice of the request is posted to the talk page of the affected project. If the project is under a parent WikiProject, a notice should be posted there as well. Essays, information pages, and other informal pages that are only supported by a small minority of the community may be moved to the primary author's userspace over deletion. The Wikipedia community has historically tolerated a wide range of Wikipedia related subjects and viewpoints on user pages.

Policies, guidelines and process pages should not be nominated for deletion, as such nominations will probably be considered disruptive, and the ensuing discussions closed early. The {{Disputed tag}} template is typically used for claims that an essay, WikiProject advice or information page was recently assigned guideline or policy status without proper or sufficient consensus being established. See WP:Local consensus for more details.

It is generally preferable that inactive WikiProjects not be deleted, but instead be marked as {{WikiProject status|inactive}}, or redirected to a relevant WikiProject, or changed to a task force of a parent WikiProject, unless the WikiProject was incompletely created or is entirely undesirable. See WP:INACTIVEWP for more details.

If a project page clearly satisfies a "general" speedy deletion criterion, it should be tagged with the appropriate template. For issues only affecting specific revisions on a page (where other page versions are fine) revision delete is usually more appropriate. To request revision-deletion for copyright violations, see {{Copyvio-revdel}} for details.

For a complete listing of past and current project namespace deletion requests at MfD, see all MfD pages with Wikipedia prefix.

Your users can simply ask what they want instead of reading the entire doc:

Question
How do I delete my wiki page?
Answer
To delete a page, first post a request at miscellany for deletion to have project pages deleted. Make sure that a notice of the request is posted to the talk page of the affected project. If the project is under a parent WikiProject, a notice should be posted there as well.