Inference Providers documentation
Table Question Answering
Get Started
Guides
Your First API CallBuilding Your First AI AppStructured Outputs with LLMsFunction CallingResponses API (beta)How to use OpenAI gpt-ossBuild an Image EditorAutomating Code Review with GitHub ActionsAgentic Coding Environments with OpenEnvEvaluating Models with Inspect
Integrations
OverviewAdd Your IntegrationClaude CodeHermes AgentNeMo Data DesignerMacWhisperOpenCodePiVision AgentsVS Code with GitHub Copilot
Inference Tasks
Providers
CerebrasCohereDeepInfraFal AIFeatherless AIFireworksGroqHyperbolicHF InferenceNovitaNscaleOVHcloud AI EndpointsPublic AIReplicateSambaNovaScalewayTogetherWaveSpeedAIZ.ai
Hub APIRegister as an Inference ProviderTable Question Answering
Table Question Answering (Table QA) is the answering a question about an information on a given table.
For more details about the
table-question-answeringtask, check out its dedicated page! You will find examples and related materials.
Recommended models
- google/tapas-base-finetuned-wtq: A robust table question answering model.
Explore all available models and find the one that suits you best here.
Using the API
Provider
Copied
import os
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="hf-inference",
api_key=os.environ["HF_TOKEN"],
)
answer = client.table_question_answering(
query="How many stars does the transformers repository have?",
table={"Repository":["Transformers","Datasets","Tokenizers"],"Stars":["36542","4512","3934"],"Contributors":["651","77","34"],"Programming language":["Python","Python","Rust, Python and NodeJS"]},
model="google/tapas-base-finetuned-wtq",
)API specification
Request
| Headers | ||
|---|---|---|
| authorization | string | Authentication header in the form 'Bearer: hf_****' when hf_**** is a personal user access token with “Inference Providers” permission. You can generate one from your settings page. |
| Payload | ||
|---|---|---|
| inputs* | object | One (table, question) pair to answer |
| table* | object | The table to serve as context for the questions |
| question* | string | The question to be answered about the table |
| parameters | object | |
| padding | enum | Possible values: do_not_pad, longest, max_length. |
| sequential | boolean | Whether to do inference sequentially or as a batch. Batching is faster, but models like SQA require the inference to be done sequentially to extract relations within sequences, given their conversational nature. |
| truncation | boolean | Activates and controls truncation. |
Response
| Body | ||
|---|---|---|
| (array) | object[] | Output is an array of objects. |
| answer | string | The answer of the question given the table. If there is an aggregator, the answer will be preceded by AGGREGATOR >. |
| coordinates | array[] | Coordinates of the cells of the answers. |
| cells | string[] | List of strings made up of the answer cell values. |
| aggregator | string | If the model has an aggregator, this returns the aggregator. |