This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +3
-4
lines changed
Expand file tree Collapse file tree 3 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ async def ollama_stream_generator(
1818 try :
1919 async for chunk in stream :
2020 try :
21+ yield f"{ chunk .model_dump_json ()} \n \n "
2122 # TODO We should wire in the client info so we can respond with
2223 # the correct format and start to handle multiple clients
2324 # in a more robust way.
Original file line number Diff line number Diff line change @@ -87,7 +87,6 @@ async def create_completion(request: Request):
8787
8888 is_fim_request = self ._is_fim_request (request , data )
8989 try :
90- print ("i create completion with data" , data )
9190 stream = await self .complete (data , api_key = None , is_fim_request = is_fim_request )
9291 except httpx .ConnectError as e :
9392 logger = structlog .get_logger ("codegate" )
@@ -103,6 +102,4 @@ async def create_completion(request: Request):
103102 else :
104103 # just continue raising the exception
105104 raise e
106- print ("result is" )
107- print (self ._completion_handler .create_response (stream ))
108105 return self ._completion_handler .create_response (stream )
Original file line number Diff line number Diff line change 11import json
22
3+ import httpx
34import structlog
45from fastapi import Header , HTTPException , Request
56
@@ -35,6 +36,7 @@ def _setup_routes(self):
3536
3637 @self .router .post (f"/{ self .provider_route_name } /chat/completions" )
3738 @self .router .post (f"/{ self .provider_route_name } /completions" )
39+ @self .router .post (f"/{ self .provider_route_name } /v1/chat/completions" )
3840 async def create_completion (
3941 request : Request ,
4042 authorization : str = Header (..., description = "Bearer token" ),
@@ -45,7 +47,6 @@ async def create_completion(
4547 api_key = authorization .split (" " )[1 ]
4648 body = await request .body ()
4749 data = json .loads (body )
48-
4950 is_fim_request = self ._is_fim_request (request , data )
5051 try :
5152 stream = await self .complete (data , api_key , is_fim_request = is_fim_request )
You can’t perform that action at this time.
0 commit comments