Skip to content

Large Language Models

Mika Hämäläinen edited this page Nov 2, 2024 · 11 revisions

UralicNLP provides a seamless, unified interface to access a variety of powerful large language models, eliminating the need for separate installations or complex setups. With UralicNLP, you can effortlessly switch between different LLMs, saving time and simplifying your workflow while gaining the flexibility to work with the model that best suits your needs—all through a single, streamlined platform.

To put it simply, you can just do:

llm.prompt("my fancy prompt")
>>"Result from LLM"

ChatGPT

To use ChatGPT, you need to pip install openai

from uralicNLP.llm import get_llm
llm = get_llm("chatgpt", "YOUR API KEY", model="gpt-4o")
llm.prompt("What is Skolt Sami?")
>>"Skolt Sami is a Uralic, Sami language spoken by the Skolt Sami people, a small indigenous Finno-Ugric ethnic group ..."

Gemini

To use Gemini, you need to pip install google-generativeai. Get the API key from AI Studio.

from uralicNLP.llm import get_llm
llm = get_llm("gemini", "YOUR API KEY", model="gemini-1.5-flash")
llm.prompt("What is Erzya?")
>>"Erzya is a **Finno-Ugric language** and the **cultural identity** of the **Erzya people**, one of the two main groups within the Mordvinic people. ..."

Mistral

To use Mistral, you need to pip install mistralai

from uralicNLP.llm import get_llm
llm = get_llm("mistral", "YOUR API KEY", model="mistral-small-latest")
llm.prompt("What is Komi-Zyrian?")
>>"Komi-Zyrian, often simply referred to as Komi, is a Uralic language spoken in the Komi Republic and some other regions of Russia. ..."

Local models

To use models from Hugging Face, you need to pip install transformers

from uralicNLP.llm import get_llm
llm = get_llm("microsoft/Phi-3.5-mini-instruct", max_length=20)
llm.prompt("What is Livonian?")
>>"What is Livonian? Livonian is an extinct Finnic language that was histor"
Clone this wiki locally