Skip to content

Commit

Permalink
fix api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed Dec 22, 2023
1 parent 187bd29 commit cfc1dc2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ollama/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def pull(
'POST',
'/api/pull',
json={
'model': model,
'name': model,
'insecure': insecure,
'stream': stream,
},
Expand All @@ -139,7 +139,7 @@ def push(
'POST',
'/api/push',
json={
'model': model,
'name': model,
'insecure': insecure,
'stream': stream,
},
Expand All @@ -164,7 +164,7 @@ def create(
'POST',
'/api/create',
json={
'model': model,
'name': model,
'modelfile': modelfile,
'stream': stream,
},
Expand Down Expand Up @@ -208,7 +208,7 @@ def _create_blob(self, path: Union[str, Path]) -> str:
return digest

def delete(self, model: str) -> Mapping[str, Any]:
response = self._request('DELETE', '/api/delete', json={'model': model})
response = self._request('DELETE', '/api/delete', json={'name': model})
return {'status': 'success' if response.status_code == 200 else 'error'}

def list(self) -> Mapping[str, Any]:
Expand All @@ -219,7 +219,7 @@ def copy(self, source: str, target: str) -> Mapping[str, Any]:
return {'status': 'success' if response.status_code == 200 else 'error'}

def show(self, model: str) -> Mapping[str, Any]:
return self._request_json('GET', '/api/show', json={'model': model})
return self._request_json('GET', '/api/show', json={'name': model})


class AsyncClient(BaseClient):
Expand Down Expand Up @@ -325,7 +325,7 @@ async def pull(
'POST',
'/api/pull',
json={
'model': model,
'name': model,
'insecure': insecure,
'stream': stream,
},
Expand All @@ -342,7 +342,7 @@ async def push(
'POST',
'/api/push',
json={
'model': model,
'name': model,
'insecure': insecure,
'stream': stream,
},
Expand All @@ -367,7 +367,7 @@ async def create(
'POST',
'/api/create',
json={
'model': model,
'name': model,
'modelfile': modelfile,
'stream': stream,
},
Expand Down Expand Up @@ -418,7 +418,7 @@ async def upload_bytes():
return digest

async def delete(self, model: str) -> Mapping[str, Any]:
response = await self._request('DELETE', '/api/delete', json={'model': model})
response = await self._request('DELETE', '/api/delete', json={'name': model})
return {'status': 'success' if response.status_code == 200 else 'error'}

async def list(self) -> Mapping[str, Any]:
Expand All @@ -430,7 +430,7 @@ async def copy(self, source: str, target: str) -> Mapping[str, Any]:
return {'status': 'success' if response.status_code == 200 else 'error'}

async def show(self, model: str) -> Mapping[str, Any]:
return await self._request_json('GET', '/api/show', json={'model': model})
return await self._request_json('GET', '/api/show', json={'name': model})


def _encode_image(image) -> str:
Expand Down

0 comments on commit cfc1dc2

Please sign in to comment.