# Trouble with the built in inference API example

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrouble-with-the-built-in-inference-api-example%2F6983%3E%5C
**Category:** Beginners\
**Created:** [June 18, 2021, 8:23pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrouble-with-the-built-in-inference-api-example%2F6983 "2021-06-18T20:23:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LowellR](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@LowellR](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLowellR)%5C
**Post date:** [June 18, 2021, 8:23pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrouble-with-the-built-in-inference-api-example%2F6983%2F1 "2021-06-18T20:23:05Z")

</div>

Hi I’m just starting out with the inference API examples. While I can get other examples to work using the same formatting , I get this error

{“error”:“d argument needs to be of type (SquadExample, dict)”}

When using the example for [deepset/roberta-base-squad2 · Hugging Face](https://huggingface.co/deepset/roberta-base-squad2)

```auto
import json
import requests

API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Fdeepset%2Froberta-base-squad2"
headers = {"Authorization": "Bearer api_xxx"}

def query(payload):
	data = json.dumps(payload)
	response = requests.request("POST", API_URL, headers=headers, data=data)
	return json.loads(response.content.decode("utf-8"))

data = query(
    {
        "inputs": {
            "question": "What's my name?",
            "context": "My name is Clara and I live in Berkeley.",
        }
    }
)

```

I’d love know how else to format the query, or what else I should double check.

Thanks for reading.

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fosanseviero)%5C
**Post date:** [June 19, 2021, 1:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrouble-with-the-built-in-inference-api-example%2F6983%2F2 "2021-06-19T13:51:07Z")

</div>

Hi @LowellR

I just tried your exact pasted code and it worked fine.

`{'answer': 'Clara', 'end': 16, 'score': 0.9326569437980652, 'start': 11}`

Could you confirm if you are running this same code?  
Thanks!

---

<div class="post-metadata">

**Author:** ![LowellR](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@LowellR](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLowellR)%5C
**Post date:** [June 19, 2021, 6:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrouble-with-the-built-in-inference-api-example%2F6983%2F3 "2021-06-19T18:40:26Z")

</div>

Thanks for taking a look @osanseviero I appreciate you testing it out. I must have some sort of formatting issue. I’ll take another look.
