[GH-ISSUE #1473] 🛍️ API for model information on ollama.ai #47306

Closed
opened 2026-04-28 03:32:52 -05:00 by GiteaMirror · 16 comments
Owner

Originally created by @adriens on GitHub (Dec 11, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1473

About

Today, model trends are available through ollama website:

image

... as well as tags:

image

... I wonder how I could get these data (eg. datascience) from an API point of view so (indeed Open Data) data-analysis on top of them.

🎯 The question

  • How can we access these data from a code perspective
  • Point any documentation that may help doing this from an API perspective
Originally created by @adriens on GitHub (Dec 11, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1473 # :grey_question: About Today, model trends are available through [ollama website](https://ollama.ai/library): ![image](https://github.com/jmorganca/ollama/assets/5235127/4b647b48-8494-44bf-83aa-c9658e648dad) ... as well as tags: ![image](https://github.com/jmorganca/ollama/assets/5235127/c5f2bad9-c541-4ed6-aa40-51d555b73075) ... I wonder how I could get these data (eg. datascience) from an API point of view so (indeed Open Data) data-analysis on top of them. # :dart: The question - How can we access these data from a code perspective :grey_question: - Point any documentation that may help doing this from an API perspective
GiteaMirror added the feature request label 2026-04-28 03:32:52 -05:00
Author
Owner

@adriens commented on GitHub (Dec 15, 2023):

<!-- gh-comment-id:1858509780 --> @adriens commented on GitHub (Dec 15, 2023): - https://github.com/jmorganca/ollama/issues/1542
Author
Owner

@adriens commented on GitHub (Dec 23, 2023):

Hi guys, while playing' with ollama, I felt on an antother usecase like : getting the list of all 7B models 💡
Any chance to get some news about this feature request 🙏

<!-- gh-comment-id:1868375953 --> @adriens commented on GitHub (Dec 23, 2023): Hi guys, while playing' with `ollama`, I felt on an antother usecase like : getting the list of all `7B` models :bulb: Any chance to get some news about this feature request :grey_question: :pray:
Author
Owner

@jmorganca commented on GitHub (Dec 24, 2023):

Hi @adriens, thanks for creating an issue! This is definitely a much needed feature. Stay tuned for updates on this one – and please keep sharing any feature requests for the kinds of data you'd like an API for!

<!-- gh-comment-id:1868599866 --> @jmorganca commented on GitHub (Dec 24, 2023): Hi @adriens, thanks for creating an issue! This is definitely a much needed feature. Stay tuned for updates on this one – and please keep sharing any feature requests for the kinds of data you'd like an API for!
Author
Owner

@adriens commented on GitHub (Dec 25, 2023):

Hi @jmorganca , thanks a lot for the kind feedback.
I'm praying for 🎅 to make this happen 🤞 ... and soon, be able to produce some cool or funny things around ollama.

<!-- gh-comment-id:1868651246 --> @adriens commented on GitHub (Dec 25, 2023): Hi @jmorganca , thanks a lot for the kind feedback. I'm praying for :santa: to make this happen :crossed_fingers: ... and soon, be able to produce some cool or funny things around ollama.
Author
Owner

@adriens commented on GitHub (Dec 29, 2023):

Thanks to the following comment on this issue:

image

It points out that API could help implementing a Dependabot'like for ollama model files 💭

<!-- gh-comment-id:1872336599 --> @adriens commented on GitHub (Dec 29, 2023): Thanks to the following comment on this [issue](https://github.com/adriens/ollama-models/issues/1#issuecomment-1872328521): ![image](https://github.com/jmorganca/ollama/assets/5235127/48b5aefd-d992-4cdc-8a08-be2e34235807) It points out that API could help implementing a Dependabot'like for `ollama` model files :thought_balloon:
Author
Owner

@peperunas commented on GitHub (Jan 17, 2024):

Would it be possible to have an endpoint that returns the models' context size? This would be very helpful for various projects:

<!-- gh-comment-id:1895411297 --> @peperunas commented on GitHub (Jan 17, 2024): Would it be possible to have an endpoint that returns the models' context size? This would be very helpful for various projects: - https://github.com/enricoros/big-AGI/issues/309 - https://github.com/mckaywrigley/chatbot-ui/issues/1157
Author
Owner

@enricoros commented on GitHub (Jan 24, 2024):

I second @peperunas. As you now provide a JS library, a richer Models List endpoint output would be beneficial.

To list the pullable models, the default option would be the OpenAI Models List API, which, however, is not a good example.

After reviewing a few Models List APIs out there, the most Developer Friendly seems to be the OpenRouter /v1/models API which includes fields that are useful for the developers/users.

For both your "pullable models" API and the "models list" (existing) API, please consider having the following fields:

  • (existing) model ID
  • name pretty name of the model (to be displayed by UIs)
  • context_length the limit to the input+output tokens
  • (optional) max_output_tokens the limit to the output tokens (some gpt4 and gemini have max output much lower than the context length)
  • description the description to show to the user, which is what shows on the website today

For the "pullable models" API only:

  • (optional) variants: ollama allows to pull a "name:variant" and this field could be a string list of all variants, so they can be pre-populated in the UI
  • (optional) added: UTC timestamp of when the model was added, for "sorting by time"
  • (optional) featured_rank: the number of the model for "sorting by featured" (lower is better)

Without a models list endpoint, UIs won't be able to tell users what to pull. In our instance (big-AGI, issues/309) we have to hardcode all the models information and keep it synced with the HTML page:
image

Thanks for considering this request, and making the best model runner the most DX/UX friendly.

<!-- gh-comment-id:1909046525 --> @enricoros commented on GitHub (Jan 24, 2024): I second @peperunas. As you now provide a JS library, a richer Models List endpoint output would be beneficial. To list the **pullable** models, the default option would be the OpenAI [Models List](https://platform.openai.com/docs/api-reference/models/list) API, which, however, is not a good example. After reviewing a few Models List APIs out there, the most Developer Friendly seems to be the [OpenRouter /v1/models](https://openrouter.ai/api/v1/models) API which includes fields that are useful for the developers/users. For both your "pullable models" API and the "models list" (existing) API, please consider having the following fields: - [x] (existing) model ID - [ ] `name` pretty name of the model (to be displayed by UIs) - [ ] **`context_length`** the limit to the input+output tokens - [ ] (optional) `max_output_tokens` the limit to the output tokens (some gpt4 and gemini have max output much lower than the context length) - [ ] **`description`** the description to show to the user, which is what shows on the website today For the "pullable models" API only: - [ ] (optional) `variants`: ollama allows to pull a "name:variant" and this field could be a string list of all variants, so they can be pre-populated in the UI - [ ] (optional) `added`: UTC timestamp of when the model was added, for "sorting by time" - [ ] (optional) `featured_rank`: the number of the model for "sorting by featured" (lower is better) Without a models list endpoint, UIs won't be able to tell users what to pull. In our instance ([big-AGI](https://github.com/enricoros/big-AGI), [issues/309](https://github.com/enricoros/big-AGI/issues/309)) we have to hardcode all the models information and keep it synced with the HTML page: ![image](https://github.com/ollama/ollama/assets/32999/24041bc1-5291-4176-849d-fe1bedfddc15) Thanks for considering this request, and making the best model runner the most DX/UX friendly.
Author
Owner

@adriens commented on GitHub (Jan 26, 2024):

<!-- gh-comment-id:1912793721 --> @adriens commented on GitHub (Jan 26, 2024): - https://github.com/ollama/ollama/issues/2218
Author
Owner

@adriens commented on GitHub (Jan 26, 2024):

🤓 Hopefully you'll appreciate this related Tweet

image

image

<!-- gh-comment-id:1912794374 --> @adriens commented on GitHub (Jan 26, 2024): [:nerd_face: Hopefully you'll appreciate this related Tweet](https://twitter.com/rastadidi/status/1751008554788724774) ![image](https://github.com/ollama/ollama/assets/5235127/0b32061d-67ab-450d-b67e-0945ef8eafe4) ![image](https://github.com/ollama/ollama/assets/5235127/18f709bd-3bdc-4238-ada4-c8e16b701228)
Author
Owner

@Crustack commented on GitHub (Jan 28, 2024):

It would be very nice for ollama.ai/library to provide a JSON API to query available model names and their tags (optionally also metadata like file-size, quantization etc.) , integrating Ollama without it means copy-pasting the available models by hand which is very tedious.
Also mentioned in https://github.com/ollama/ollama/issues/2022

<!-- gh-comment-id:1913673327 --> @Crustack commented on GitHub (Jan 28, 2024): It would be very nice for [ollama.ai/library](https://ollama.ai/library) to provide a JSON API to query available model names and their tags (optionally also metadata like file-size, quantization etc.) , integrating Ollama without it means copy-pasting the available models by hand which is very tedious. Also mentioned in https://github.com/ollama/ollama/issues/2022
Author
Owner

@adriens commented on GitHub (Jan 28, 2024):

@PhilKes , I'll deliver something within next week. It won't be an API but it sould help in discoverings models, tags,...

<!-- gh-comment-id:1913710613 --> @adriens commented on GitHub (Jan 28, 2024): @PhilKes , I'll deliver something within next week. It won't be an API but it sould help in discoverings models, tags,...
Author
Owner

@adriens commented on GitHub (Feb 8, 2024):

🎁https://www.kaggle.com/datasets/adriensales/ollama-models/

Tweet

image

<!-- gh-comment-id:1934911485 --> @adriens commented on GitHub (Feb 8, 2024): :gift:https://www.kaggle.com/datasets/adriensales/ollama-models/ [Tweet](https://twitter.com/rastadidi/status/1755694623044010386) ![image](https://github.com/ollama/ollama/assets/5235127/2449f2b7-a86c-4854-9172-8c6e750de129)
Author
Owner

@jmorganca commented on GitHub (May 6, 2024):

Merging this with https://github.com/ollama/ollama/issues/1070

<!-- gh-comment-id:2097116187 --> @jmorganca commented on GitHub (May 6, 2024): Merging this with https://github.com/ollama/ollama/issues/1070
Author
Owner

@webfarmer commented on GitHub (Oct 2, 2024):

I responded with this in another post, too.

I've created a python script that just does the job, but you need to:

pip install bs4

https://github.com/webfarmer/ollama-get-models

Definitely not ideal, and probably will be deprecated in a few months, but whatever.

This Python script scrapes information about AI models from the Ollama library website (https://ollama.com/library). It performs the following main tasks:

It first checks if a local HTML file exists. If not, it fetches the webpage content and saves it locally.
It then parses the HTML content using BeautifulSoup to extract details about each model, including name, description, sizes, number of pulls, tags, and last updated date.

The extracted information is printed to the console and also saved as a JSON file.

The script includes error handling for failed web requests and creates necessary directories if they don't exist.

This code allows users to easily obtain and store up-to-date information about available models in the Ollama library without manually browsing the website.

<!-- gh-comment-id:2388130619 --> @webfarmer commented on GitHub (Oct 2, 2024): I responded with this in another post, too. I've created a python script that just does the job, but you need to: `pip install bs4 ` https://github.com/webfarmer/ollama-get-models Definitely not ideal, and probably will be deprecated in a few months, but whatever. This Python script scrapes information about AI models from the Ollama library website (https://ollama.com/library). It performs the following main tasks: It first checks if a local HTML file exists. If not, it fetches the webpage content and saves it locally. It then parses the HTML content using BeautifulSoup to extract details about each model, including name, description, sizes, number of pulls, tags, and last updated date. The extracted information is printed to the console and also saved as a JSON file. The script includes error handling for failed web requests and creates necessary directories if they don't exist. This code allows users to easily obtain and store up-to-date information about available models in the Ollama library without manually browsing the website.
Author
Owner

@oppenheimer- commented on GitHub (Oct 18, 2024):

just discovered this repo

name, description and tags are available as JSON here: https://ollama-models.zwz.workers.dev/
API seems to be working and up to date per today; models are sorted by "featured"

<!-- gh-comment-id:2421521786 --> @oppenheimer- commented on GitHub (Oct 18, 2024): just discovered this [repo](https://github.com/akazwz/ollama-models) name, description and tags are available as JSON here: [https://ollama-models.zwz.workers.dev/](https://ollama-models.zwz.workers.dev/) API seems to be working and up to date per today; models are sorted by "featured"
Author
Owner

@rmariboe commented on GitHub (Nov 9, 2024):

I hacked this abomination together - gets the job done 😅

function Get-OllamaModels {
 $ollamaLibUri = 'https://ollama.com/library'
 $ollamaLib = Invoke-WebRequest -Uri $ollamaLibUri
 $modelLinks = $ollamaLib.Links | Where-Object {$_.href.StartsWith('/library/')}

 $ollamaModelWebRequest = {
  $ollamaModelUri = 'https://ollama.com/library/' + $this.Name
  $ollamaModel = Invoke-WebRequest -Uri $ollamaModelUri
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModel -Force -PassThru).ModelWebRequestResponse
 }

 $ollamaModelTagsWebRequest = {
  $ollamaModelTagsUri = 'https://ollama.com/library/' + $this.Name + '/tags'
  $ollamaModelTags = Invoke-WebRequest -Uri $ollamaModelTagsUri
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTags -Force -PassThru).ModelTagsWebRequestResponse
 }
   
 $ollamaModelReadmeFunction = {
  $readmeIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>') + '<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>'.Length
  $readmeTextareaIndexDelimiterStart = '<textarea'
  $readmeTextareaIndexStart = $this.ModelWebRequestResponse.Content.IndexOf($readmeTextareaIndexDelimiterStart, $readmeIndexStart) + $readmeTextareaIndexDelimiterStart.Length
  $readmeTextIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('>', $readmeTextareaIndexStart) + '>'.Length
  $readmeTextareaIndexEnd = $this.ModelWebRequestResponse.Content.IndexOf('</textarea', $readmeTextIndexStart)
  $this.ModelWebRequestResponse.Content.Substring($readmeTextIndexStart, $readmeTextareaIndexEnd - $readmeTextIndexStart).Trim()
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Description' -Value $ollamaModelDescription -Force -PassThru).Description
 }

 $ollamaModelTagsFunction = {
  $ollamaModelTagLinks = $this.ModelTagsWebRequestResponse.Links | Where-Object {$_.class -eq 'group'}
  $ollamaModelTagInfo = @()
  foreach ($ollamaModelTagLink in $ollamaModelTagLinks) {
   $ollamaModelTagName = $ollamaModelTagLink.href.Split('/')[-1]
   $ollamaModelTagInfoStart = $this.ModelTagsWebRequestResponse.Content.IndexOf($ollamaModelTagLink.outerHTML) + $ollamaModelTagLink.outerHTML.Length
   $ollamaModelTagIdEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagInfoStart) + '</span>'.Length
   $ollamaModelTagInfoEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagIdEnd)
   $ollamaModelTagInfoSplit = $this.ModelTagsWebRequestResponse.Content.Substring($ollamaModelTagIdEnd, $ollamaModelTagInfoEnd - $ollamaModelTagIdEnd).Split("`n")
   $ollamaModelTagInfoSizeHumanReadable = $ollamaModelTagInfoSplit[0].Trim().Split(' ')[1]
   try {$ollamaModelTagInfoSize = [int64][scriptblock]::Create($ollamaModelTagInfoSizeHumanReadable).InvokeReturnAsIs()} catch {}
   $ollamaModelTagInfoUpdated = $ollamaModelTagInfoSplit[1].Trim()
   $ollamaModelTagInfo += [pscustomobject]@{
    'Name' = $ollamaModelTagName;
    'Size' = $ollamaModelTagInfoSize;
    'SizeHumanReadable' = $ollamaModelTagInfoSizeHumanReadable;
    'Updated' = $ollamaModelTagInfoUpdated
   }
  }
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Tags' -Value $ollamaModelTagInfo -Force -PassThru).Tags
 }

 $modelLinks | ForEach-Object {
  $ollamaModelLinkDescriptionDelimiterStart = '<p class="max-w-lg break-words text-neutral-800 text-md">'
  $ollamaModelLinkDescriptionStart = $_.outerHTML.IndexOf($ollamaModelLinkDescriptionDelimiterStart) + $ollamaModelLinkDescriptionDelimiterStart.Length
  $ollamaModelLinkDescriptionEnd = $_.outerHTML.IndexOf('</p>', $ollamaModelLinkDescriptionStart)
  $ollamaModelLinkDescription = $_.outerHTML.SubString($ollamaModelLinkDescriptionStart, $ollamaModelLinkDescriptionEnd - $ollamaModelLinkDescriptionStart).Trim()

  $ollamaModelLinkPullCountDelimiterStart = '<span x-test-pull-count>'
  $ollamaModelLinkPullCountStart = $_.outerHTML.IndexOf($ollamaModelLinkPullCountDelimiterStart) + $ollamaModelLinkPullCountDelimiterStart.Length
  $ollamaModelLinkPullCountEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkPullCountStart)
  $ollamaModelLinkPullCount = $_.outerHTML.SubString($ollamaModelLinkPullCountStart, $ollamaModelLinkPullCountEnd - $ollamaModelLinkPullCountStart).Trim()

  $ollamaModelLinkUpdatedDelimiterStart = '<span x-test-updated>'
  $ollamaModelLinkUpdatedStart = $_.outerHTML.IndexOf($ollamaModelLinkUpdatedDelimiterStart) + $ollamaModelLinkUpdatedDelimiterStart.Length
  $ollamaModelLinkUpdatedEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkUpdatedStart)
  $ollamaModelLinkUpdated = $_.outerHTML.SubString($ollamaModelLinkUpdatedStart, $ollamaModelLinkUpdatedEnd - $ollamaModelLinkUpdatedStart).Trim()

  $ollamaModelLinkCapabilitiesDelimiterStart = '<span x-test-capability class="inline-flex items-center rounded-md bg-indigo-50 px-2 py-0.5 text-xs font-medium text-indigo-600 sm:text-[13px]">'
  if ($_.outerHTML.Contains($ollamaModelLinkCapabilitiesDelimiterStart)) {
   $ollamaModelLinkCapabilitiesStart = $_.outerHTML.IndexOf($ollamaModelLinkCapabilitiesDelimiterStart) + $ollamaModelLinkCapabilitiesDelimiterStart.Length
   $ollamaModelLinkCapabilitiesEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkCapabilitiesStart)
   $ollamaModelLinkCapabilities = $_.outerHTML.SubString($ollamaModelLinkCapabilitiesStart, $ollamaModelLinkCapabilitiesEnd - $ollamaModelLinkCapabilitiesStart).Trim()
  }

  $ollamaModelLinkSizeDelimiterStart = '<span x-test-size class="inline-flex items-center rounded-md bg-[#ddf4ff] px-2 py-0.5 text-xs font-medium text-blue-600 sm:text-[13px]">'
  if ($_.outerHTML.Contains($ollamaModelLinkSizeDelimiterStart)) {
   $ollamaModelLinkSizeStart = $_.outerHTML.IndexOf($ollamaModelLinkSizeDelimiterStart) + $ollamaModelLinkSizeDelimiterStart.Length
   $ollamaModelLinkSizeEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkSizeStart)
   $ollamaModelLinkSize = $_.outerHTML.SubString($ollamaModelLinkSizeStart, $ollamaModelLinkSizeEnd - $ollamaModelLinkSizeStart).Trim()
  }

  [pscustomobject]@{
   'Name' = $_.href.Split('/')[-1].Trim();
   'Description' = $ollamaModelLinkDescription;
   'PullCount' = $ollamaModelLinkPullCount;
   'Updated' = $ollamaModelLinkUpdated;
   'Capabilities' = $ollamaModelLinkCapabilities;
   'Size' = $ollamaModelLinkSize
  } |
  Add-Member -MemberType 'ScriptProperty' -Name 'Readme' -Value $ollamaModelReadmeFunction -PassThru |
  Add-Member -MemberType 'ScriptProperty' -Name 'Tags' -Value $ollamaModelTagsFunction -PassThru |
  Add-Member -MemberType 'ScriptProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModelWebRequest -PassThru |
  Add-Member -MemberType 'ScriptProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTagsWebRequest -PassThru
 }
}
<!-- gh-comment-id:2465945641 --> @rmariboe commented on GitHub (Nov 9, 2024): I hacked this abomination together - gets the job done 😅 ```powershell function Get-OllamaModels { $ollamaLibUri = 'https://ollama.com/library' $ollamaLib = Invoke-WebRequest -Uri $ollamaLibUri $modelLinks = $ollamaLib.Links | Where-Object {$_.href.StartsWith('/library/')} $ollamaModelWebRequest = { $ollamaModelUri = 'https://ollama.com/library/' + $this.Name $ollamaModel = Invoke-WebRequest -Uri $ollamaModelUri return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModel -Force -PassThru).ModelWebRequestResponse } $ollamaModelTagsWebRequest = { $ollamaModelTagsUri = 'https://ollama.com/library/' + $this.Name + '/tags' $ollamaModelTags = Invoke-WebRequest -Uri $ollamaModelTagsUri return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTags -Force -PassThru).ModelTagsWebRequestResponse } $ollamaModelReadmeFunction = { $readmeIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>') + '<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>'.Length $readmeTextareaIndexDelimiterStart = '<textarea' $readmeTextareaIndexStart = $this.ModelWebRequestResponse.Content.IndexOf($readmeTextareaIndexDelimiterStart, $readmeIndexStart) + $readmeTextareaIndexDelimiterStart.Length $readmeTextIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('>', $readmeTextareaIndexStart) + '>'.Length $readmeTextareaIndexEnd = $this.ModelWebRequestResponse.Content.IndexOf('</textarea', $readmeTextIndexStart) $this.ModelWebRequestResponse.Content.Substring($readmeTextIndexStart, $readmeTextareaIndexEnd - $readmeTextIndexStart).Trim() return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Description' -Value $ollamaModelDescription -Force -PassThru).Description } $ollamaModelTagsFunction = { $ollamaModelTagLinks = $this.ModelTagsWebRequestResponse.Links | Where-Object {$_.class -eq 'group'} $ollamaModelTagInfo = @() foreach ($ollamaModelTagLink in $ollamaModelTagLinks) { $ollamaModelTagName = $ollamaModelTagLink.href.Split('/')[-1] $ollamaModelTagInfoStart = $this.ModelTagsWebRequestResponse.Content.IndexOf($ollamaModelTagLink.outerHTML) + $ollamaModelTagLink.outerHTML.Length $ollamaModelTagIdEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagInfoStart) + '</span>'.Length $ollamaModelTagInfoEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagIdEnd) $ollamaModelTagInfoSplit = $this.ModelTagsWebRequestResponse.Content.Substring($ollamaModelTagIdEnd, $ollamaModelTagInfoEnd - $ollamaModelTagIdEnd).Split("`n") $ollamaModelTagInfoSizeHumanReadable = $ollamaModelTagInfoSplit[0].Trim().Split(' ')[1] try {$ollamaModelTagInfoSize = [int64][scriptblock]::Create($ollamaModelTagInfoSizeHumanReadable).InvokeReturnAsIs()} catch {} $ollamaModelTagInfoUpdated = $ollamaModelTagInfoSplit[1].Trim() $ollamaModelTagInfo += [pscustomobject]@{ 'Name' = $ollamaModelTagName; 'Size' = $ollamaModelTagInfoSize; 'SizeHumanReadable' = $ollamaModelTagInfoSizeHumanReadable; 'Updated' = $ollamaModelTagInfoUpdated } } return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Tags' -Value $ollamaModelTagInfo -Force -PassThru).Tags } $modelLinks | ForEach-Object { $ollamaModelLinkDescriptionDelimiterStart = '<p class="max-w-lg break-words text-neutral-800 text-md">' $ollamaModelLinkDescriptionStart = $_.outerHTML.IndexOf($ollamaModelLinkDescriptionDelimiterStart) + $ollamaModelLinkDescriptionDelimiterStart.Length $ollamaModelLinkDescriptionEnd = $_.outerHTML.IndexOf('</p>', $ollamaModelLinkDescriptionStart) $ollamaModelLinkDescription = $_.outerHTML.SubString($ollamaModelLinkDescriptionStart, $ollamaModelLinkDescriptionEnd - $ollamaModelLinkDescriptionStart).Trim() $ollamaModelLinkPullCountDelimiterStart = '<span x-test-pull-count>' $ollamaModelLinkPullCountStart = $_.outerHTML.IndexOf($ollamaModelLinkPullCountDelimiterStart) + $ollamaModelLinkPullCountDelimiterStart.Length $ollamaModelLinkPullCountEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkPullCountStart) $ollamaModelLinkPullCount = $_.outerHTML.SubString($ollamaModelLinkPullCountStart, $ollamaModelLinkPullCountEnd - $ollamaModelLinkPullCountStart).Trim() $ollamaModelLinkUpdatedDelimiterStart = '<span x-test-updated>' $ollamaModelLinkUpdatedStart = $_.outerHTML.IndexOf($ollamaModelLinkUpdatedDelimiterStart) + $ollamaModelLinkUpdatedDelimiterStart.Length $ollamaModelLinkUpdatedEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkUpdatedStart) $ollamaModelLinkUpdated = $_.outerHTML.SubString($ollamaModelLinkUpdatedStart, $ollamaModelLinkUpdatedEnd - $ollamaModelLinkUpdatedStart).Trim() $ollamaModelLinkCapabilitiesDelimiterStart = '<span x-test-capability class="inline-flex items-center rounded-md bg-indigo-50 px-2 py-0.5 text-xs font-medium text-indigo-600 sm:text-[13px]">' if ($_.outerHTML.Contains($ollamaModelLinkCapabilitiesDelimiterStart)) { $ollamaModelLinkCapabilitiesStart = $_.outerHTML.IndexOf($ollamaModelLinkCapabilitiesDelimiterStart) + $ollamaModelLinkCapabilitiesDelimiterStart.Length $ollamaModelLinkCapabilitiesEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkCapabilitiesStart) $ollamaModelLinkCapabilities = $_.outerHTML.SubString($ollamaModelLinkCapabilitiesStart, $ollamaModelLinkCapabilitiesEnd - $ollamaModelLinkCapabilitiesStart).Trim() } $ollamaModelLinkSizeDelimiterStart = '<span x-test-size class="inline-flex items-center rounded-md bg-[#ddf4ff] px-2 py-0.5 text-xs font-medium text-blue-600 sm:text-[13px]">' if ($_.outerHTML.Contains($ollamaModelLinkSizeDelimiterStart)) { $ollamaModelLinkSizeStart = $_.outerHTML.IndexOf($ollamaModelLinkSizeDelimiterStart) + $ollamaModelLinkSizeDelimiterStart.Length $ollamaModelLinkSizeEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkSizeStart) $ollamaModelLinkSize = $_.outerHTML.SubString($ollamaModelLinkSizeStart, $ollamaModelLinkSizeEnd - $ollamaModelLinkSizeStart).Trim() } [pscustomobject]@{ 'Name' = $_.href.Split('/')[-1].Trim(); 'Description' = $ollamaModelLinkDescription; 'PullCount' = $ollamaModelLinkPullCount; 'Updated' = $ollamaModelLinkUpdated; 'Capabilities' = $ollamaModelLinkCapabilities; 'Size' = $ollamaModelLinkSize } | Add-Member -MemberType 'ScriptProperty' -Name 'Readme' -Value $ollamaModelReadmeFunction -PassThru | Add-Member -MemberType 'ScriptProperty' -Name 'Tags' -Value $ollamaModelTagsFunction -PassThru | Add-Member -MemberType 'ScriptProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModelWebRequest -PassThru | Add-Member -MemberType 'ScriptProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTagsWebRequest -PassThru } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#47306