Skip to content

Commit 991584d

Browse files
fix(http_llm): auto fill url (#5)
1 parent c3e31b0 commit 991584d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

oxygent/oxy/llms/http_llm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ async def _execute(self, oxy_request: OxyRequest) -> OxyResponse:
4040
"""
4141
use_openai = self.api_key is not None
4242
url = self.base_url.rstrip("/")
43+
if use_openai:
44+
if not url.endswith("/chat/completions"):
45+
url = f"{url}/chat/completions"
46+
else:
47+
if not url.endswith("/api/chat"): # only support ollama
48+
url = f"{url}/api/chat"
4349
headers = {"Content-Type": "application/json"}
4450
if use_openai:
4551
headers["Authorization"] = f"Bearer {self.api_key}"

0 commit comments

Comments
 (0)