# Serverless inference issues for a new Go library

**URL:** <https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000>\
**Category:** Inference Endpoints on the Hub\
**Created:** [March 16, 2025, 5:40pm UTC](https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000 "2025-03-16T17:40:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maruel](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/maruel/32/43410_2.png) [@maruel](https://discuss.huggingface.co/u/maruel)\
**Post date:** [March 16, 2025, 5:40pm UTC](https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000/1 "2025-03-16T17:40:21Z")

</div>

I’m writing a new library in Go using the serverless inference API and I hit a few problems:

- The documentation at [Chat Completion](https://huggingface.co/docs/api-inference/tasks/chat-completion) is very focused on the python library, and doesn’t list much for the REST API. to the point that the URL format to use isn’t even listed. I use `"https://router.huggingface.co/hf-inference/models/" + model + "/v1/chat/completions"`. I do not need OpenAI compatibility, whatever is closest to native implementation is better for me.
- When I make a mistake, I get a whole HTML page with `<h1>503</h1>` instead of an error message in JSON. That’s really hurting my progress. It seems there’s a reverse proxxy on the router that is eating the error messages.
- I failed to create a test example that works with JSON schema for structured reply. What example (in any language) would you point me to? I see that Célina and Lucain recently updated the test case test\_chat\_completion\_with\_response\_format() and it’s now skipped. [huggingface\_hub/tests/test\_inference\_client.py at main · huggingface/huggingface\_hub · GitHub](https://github.com/huggingface/huggingface_hub/blob/main/tests/test_inference_client.py#L415)

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 17, 2025, 5:26am UTC](https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000/2 "2025-03-17T05:26:28Z")

</div>

First of all, the Serverless Inference API is currently being completely overhauled, so if you have any questions about the broad changes that will be made in the future, it would be better to ask them on the github issues page.

### Library issue

> **[huggingface/huggingface\_hub](https://github.com/huggingface/huggingface_hub/issues)**
>
> The official Python client for the Hugging Face Hub. - huggingface/huggingface\_hub

### Non-library issue

> **[huggingface/hub-docs](https://github.com/huggingface/hub-docs/issues)**
>
> Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.

> documentation

There is some.

 ![apicurl](https://us1.discourse-cdn.com/hellohellohello/original/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719.png)

> I get a whole HTML page with `<h1>503</h1>` instead of an error message in JSON

Same here…😭

---

<div class="post-metadata">

**Author:** ![maruel](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/maruel/32/43410_2.png) [@maruel](https://discuss.huggingface.co/u/maruel)\
**Post date:** [March 17, 2025, 2:51pm UTC](https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000/3 "2025-03-17T14:51:00Z")

</div>

Thanks, that was super useful!

Looks like it’s half-cooked:

- [Incompatibility between OpenAI and HF's Chat Completion `response_format` · Issue #932 · huggingface/huggingface.js · GitHub](https://github.com/huggingface/huggingface.js/issues/932)
- [Support `reponse_format: {"type": "json_object"}` without any constrained schema · Issue #2899 · huggingface/text-generation-inference · GitHub](https://github.com/huggingface/text-generation-inference/issues/2899)
- [response\_format with regex does not seem to work · Issue #2423 · huggingface/huggingface\_hub · GitHub](https://github.com/huggingface/huggingface_hub/issues/2423) (about regex but useful to know)

I’m waiting for google/gemma-3-4b-it to be properly supported on serverless inference so I can test it out more coupled with vision.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 17, 2025, 4:47pm UTC](https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000/4 "2025-03-17T16:47:13Z")

</div>

As for Gemma 3, we just have to be patient until this fork is merged into main. It probably won’t take that long.

> **[GitHub - huggingface/transformers at v4.49.0-Gemma-3](https://github.com/huggingface/transformers/tree/v4.49.0-Gemma-3)**
>
> v4.49.0-Gemma-3

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [March 18, 2025, 4:47am UTC](https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000/5 "2025-03-18T04:47:36Z")

</div>

Closed on March 18, 2025, 4:47am UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
