πŸ™ˆ Poor mans model list API: Through Web Scraping!

I just made an Open WebUI plugin: SambaNova Function | Open WebUI Community

:see_no_evil: It leverages this neat trick:

def get_sambanova_models(self):
    # Hey, wanna see something crazy?
    # SambaNova offers no model listing API endpoint at the moment.
    # However, we can scrape it from the documentation:
    # https://community.sambanova.ai/t/supported-models/193
    response = requests.get("https://community.sambanova.ai/t/supported-models/193")
    response.raise_for_status()
    soup = BeautifulSoup(response.text, "html.parser")
    code_texts = [code.get_text() for code in soup.find_all("code")]
    return code_texts

It is just like doing [...document.querySelectorAll('code')].map(el => el.textContent) in the browser console:

Fun that it works, but also kinda frail!

:pray: Any chance an official model list endpoint could be added? That would make the SambaNova API one step closer to working with GitHub - open-webui/open-webui: User-friendly AI Interface (Supports Ollama, OpenAI API, ...) out of the box!

3 Likes

@olof Welcome to the community.
That is awesome work.
We definitely understand the requirement and we have an enhancement request opened for this functionality. We’re working on an ETA.
Thanks & Regards

1 Like