davidmigloz / langchain_dart

Build LLM-powered Dart/Flutter applications.
https://langchaindart.dev
MIT License
387 stars 68 forks source link

Function to get a list of model options for the various langchain platforms #371

Open danemadsen opened 4 months ago

danemadsen commented 4 months ago

Feature request

Many of the different AI platforms have an api for getting a list of available models. For instance Open AI and Mistral have the /v1/models endpoint and Ollama has the /api/tags endpoint.

Motivation

This makes it easier to for the user to dynamically set a model and means that when models go outdated, or are no longer compatible with the API they don't have to be manually removed

Your contribution

I've already implemented similar logic for Ollama, Mistral and OpenAI into maid. See below:

https://github.com/Mobile-Artificial-Intelligence/maid/blob/main/lib/classes/open_ai_model.dart#L94-L130

https://github.com/Mobile-Artificial-Intelligence/maid/blob/main/lib/classes/mistral_ai_model.dart#L92-L124

https://github.com/Mobile-Artificial-Intelligence/maid/blob/main/lib/classes/ollama_model.dart#L210-L237

davidmigloz commented 4 months ago

hey @danemadsen,

Indeed, sounds like a nice thing to have. It should be pretty straightforward to implement, as the model endpoints are already implemented in the respective clients.

I'm currently busy with this ticket, I can work on it afterwards.