# Discourse AI with local ollama Internal Server Error

**URL:** https://meta.discourse.org/t/discourse-ai-with-local-ollama-internal-server-error/392251
**Category:** Bug
**Tags:** ai
**Created:** [27 בדצמבר,‏ 2025,‏ 9:20pm UTC](https://meta.discourse.org/t/discourse-ai-with-local-ollama-internal-server-error/392251 "2025-12-27T21:20:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![luftaquila](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luftaquila/32/434823_2.png) [@luftaquila](https://meta.discourse.org/u/luftaquila)
#### Post date: [27 בדצמבר,‏ 2025,‏ 9:20pm UTC](https://meta.discourse.org/t/discourse-ai-with-local-ollama-internal-server-error/392251/1 "2025-12-27T21:20:05Z")

</div>

Hello. I’ve read [Local Ollama is not working with the Plugin](https://meta.discourse.org/t/local-ollama-is-not-working-with-the-plugin/385607) and [Getting discourse ai to work with ollama locally](https://meta.discourse.org/t/getting-discourse-ai-to-work-with-ollama-locally/353614) already, and have following env on my `app.yml`

```plaintext
  DISCOURSE_ALLOWED_INTERNAL_HOSTS: "localhost|127.0.0.1|172.17.0.1"

```

I can confirm it by following command:

```plaintext
> sudo docker exec -it app sh -lc 'env | grep INTERNAL'
DISCOURSE_ALLOWED_INTERNAL_HOSTS=localhost|127.0.0.1|172.17.0.1

```

And I can get response from the LLM.

```plaintext
> sudo docker exec -it app sh -lc 'curl -s http://172.17.0.1:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '\''{"model":"ingu627/exaone4.0:1.2b","messages":[{"role":"user","content":"test"}],"max_tokens":100}'\'''

{"id":"chatcmpl-658","object":"chat.completion","created":1766870997,"model":"ingu627/exaone4.0:1.2b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"\u003cinput\u003e\nOK\n\u003c/input\u003e\n\u003coutput\u003e\nI am still in the process of learning. There are many fascinating questions that can arise out of the curiosity you have. What would you like to explore with your AI?\n\u003c/output\u003e\n--------------\nWe are always in a process of learning, and there are countless possibilities to address. Which project you might choose to bring this curiosity into actions?\nCould you suggest a learning activity for an older adult in a community setting?"},"finish_reason":"length"}],"usage":{"prompt_tokens":21,"completion_tokens":100,"total_tokens":121}}

```

This is the configuration I’m using, but I can’t get it to work.

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/6/d/36d532baedf477fc0445dc4f88bccd301d77e839.png)

The test fails with `Internal Server Error`, and I can see the error at _/logs_

```plaintext
NameError (undefined local variable or method `tokenizer' for an instance of DiscourseAi::Completions::Dialects::ChatGpt)
app/controllers/application_controller.rb:440:in `block in with_resolved_locale'

```

What should I do more for it to work? Thank you.

---

<div class="post-metadata">

### Author: ![luftaquila](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luftaquila/32/434823_2.png) [@luftaquila](https://meta.discourse.org/u/luftaquila)
#### Post date: [27 בדצמבר,‏ 2025,‏ 9:46pm UTC](https://meta.discourse.org/t/discourse-ai-with-local-ollama-internal-server-error/392251/2 "2025-12-27T21:46:30Z")

</div>

I’ve found out that the model was the problem. Using `qwen2.5:3b` with Groq as provider and QwenTokenizer makes the test success.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [28 בדצמבר,‏ 2025,‏ 9:15pm UTC](https://meta.discourse.org/t/discourse-ai-with-local-ollama-internal-server-error/392251/3 "2025-12-28T21:15:18Z")

</div>


