[PR #256] [CLOSED] support base path. this is useful for multiple applications under one… #439

Closed
opened 2026-02-15 16:30:24 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama-python/pull/256
Author: @yuxiaojian
Created: 8/17/2024
Status: Closed

Base: mainHead: support_base_path


📝 Commits (1)

  • ef18d08 support base path. this is useful for multiple applications under one domain. with a base_path like /app1/, /app2/, etc., each application can have its own URL prefix, allowing clients to access them correctly.

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 ollama/_client.py (+4 -1)

📄 Description

Support base path. This is useful for multiple applications under one domain. With a base_path like /app1/, /app2/, etc., each application can have its own URL prefix, allowing clients to access them correctly.

e.g.

from ollama import Client
import httpx
httpx_auth = httpx.BasicAuth(username="ollama", password="xxxxx")
client = Client(host='https://ollama.service:32675/ollama', auth=httpx_auth)

stream = client.chat(model='llama3.1', messages=[
  {
    'role': 'user',
    'content': 'tell me a joke?',
  }], stream=True)

for chunk in stream:
  print(chunk['message']['content'], end='', flush=True)

The chat request will be sent to "https://ollama.service:32675/ollama/api/chat"


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama-python/pull/256 **Author:** [@yuxiaojian](https://github.com/yuxiaojian) **Created:** 8/17/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `support_base_path` --- ### 📝 Commits (1) - [`ef18d08`](https://github.com/ollama/ollama-python/commit/ef18d0878a89fffcbb9144f9ef34bb7b4dac9da9) support base path. this is useful for multiple applications under one domain. with a `base_path` like `/app1/`, `/app2/`, etc., each application can have its own URL prefix, allowing clients to access them correctly. ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `ollama/_client.py` (+4 -1) </details> ### 📄 Description Support base path. This is useful for multiple applications under one domain. With a `base_path` like `/app1/`, `/app2/`, etc., each application can have its own URL prefix, allowing clients to access them correctly. e.g. ```python from ollama import Client import httpx httpx_auth = httpx.BasicAuth(username="ollama", password="xxxxx") client = Client(host='https://ollama.service:32675/ollama', auth=httpx_auth) stream = client.chat(model='llama3.1', messages=[ { 'role': 'user', 'content': 'tell me a joke?', }], stream=True) for chunk in stream: print(chunk['message']['content'], end='', flush=True) ``` The chat request will be sent to "https://ollama.service:32675/ollama/api/chat" --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 16:30:24 -05:00
yindo closed this issue 2026-02-15 16:30:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#439