Skip to content

Commit a0388b2

Browse files
committed
unhide create_blob
1 parent f718dab commit a0388b2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ollama/_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,12 @@ def _parse_modelfile(self, modelfile: str, base: Optional[Path] = None) -> str:
559559
path = Path(args.strip()).expanduser()
560560
path = path if path.is_absolute() else base / path
561561
if path.exists():
562-
args = f'@{self._create_blob(path)}\n'
562+
args = f'@{self.create_blob(path)}\n'
563563
print(command, args, end='', file=out)
564564

565565
return out.getvalue()
566566

567-
def _create_blob(self, path: Union[str, Path]) -> str:
567+
def create_blob(self, path: Union[str, Path]) -> str:
568568
sha256sum = sha256()
569569
with open(path, 'rb') as r:
570570
while True:
@@ -1061,12 +1061,12 @@ async def _parse_modelfile(self, modelfile: str, base: Optional[Path] = None) ->
10611061
path = Path(args.strip()).expanduser()
10621062
path = path if path.is_absolute() else base / path
10631063
if path.exists():
1064-
args = f'@{await self._create_blob(path)}\n'
1064+
args = f'@{await self.create_blob(path)}\n'
10651065
print(command, args, end='', file=out)
10661066

10671067
return out.getvalue()
10681068

1069-
async def _create_blob(self, path: Union[str, Path]) -> str:
1069+
async def create_blob(self, path: Union[str, Path]) -> str:
10701070
sha256sum = sha256()
10711071
with open(path, 'rb') as r:
10721072
while True:

tests/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def test_client_create_blob(httpserver: HTTPServer):
622622
client = Client(httpserver.url_for('/'))
623623

624624
with tempfile.NamedTemporaryFile() as blob:
625-
response = client._create_blob(blob.name)
625+
response = client.create_blob(blob.name)
626626
assert response == 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
627627

628628

@@ -632,7 +632,7 @@ def test_client_create_blob_exists(httpserver: HTTPServer):
632632
client = Client(httpserver.url_for('/'))
633633

634634
with tempfile.NamedTemporaryFile() as blob:
635-
response = client._create_blob(blob.name)
635+
response = client.create_blob(blob.name)
636636
assert response == 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
637637

638638

@@ -1098,7 +1098,7 @@ async def test_async_client_create_blob(httpserver: HTTPServer):
10981098
client = AsyncClient(httpserver.url_for('/'))
10991099

11001100
with tempfile.NamedTemporaryFile() as blob:
1101-
response = await client._create_blob(blob.name)
1101+
response = await client.create_blob(blob.name)
11021102
assert response == 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
11031103

11041104

@@ -1109,7 +1109,7 @@ async def test_async_client_create_blob_exists(httpserver: HTTPServer):
11091109
client = AsyncClient(httpserver.url_for('/'))
11101110

11111111
with tempfile.NamedTemporaryFile() as blob:
1112-
response = await client._create_blob(blob.name)
1112+
response = await client.create_blob(blob.name)
11131113
assert response == 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
11141114

11151115

0 commit comments

Comments
 (0)