Skip to main content

NiceLLM is a wrangler of API connections of Large Language Models (LLMs) in Python.

Project description

NiceLLM: A Python LLM toolkit

About

NiceLLM is a Python package that homologates mainstream library functions of Large Language Models (LLMs), such as OpenAI, MistralAI, and Google Generative AI, into a unique and simple interface for the user.

Main Features

  • Simplified handling of API connections
  • Simplified interface to use images in the prompt

Installation

The source code can be found at https://github.com/idealab-udec/nicellm.

pip install nicellm

Initial config

To initialize the functions of nicellm, you will need to set some environment variables, which will contain the API keys for OpenAI and Google Generative AI. We suggest to create a file called .env in your root folder with the following information:

APIKEY_GOOGLE="YOUR-API-KEY-FROM-GENERATIVE-AI"
APIKEY_OPENAI="YOUR-API-KEY-FROM-OPEN-AI"
APIKEY_MISTRAL="YOUR-API-KEY-FROM-MISTRAL"

It is not mandatory to set up all env variables. However, you must set up at least the ones corresponding to the models you want to use.

To obtain your API keys, please visit:

Usage

Interact with gpt-3.5-turbo:

import nicellm as llm

llm.get_response(
    model_id="gpt-3.5-turbo",
    prompt="Who is the best LLM in the world?"
)

The same question can be easily replicated using gemini-pro:

llm.get_response(
    model_id="gemini-pro",
    prompt="Who is the best LLM in the world?"
)

By using mistral-tiny:

llm.get_response(
    model_id="mistral-tiny",
    prompt="Who is the best LLM in the world?"
)

Contributions

This project is maintained by the Interdisciplinary Education & Artificial Intelligence Lab, IDEALAB, from the University of Concepción, Chile.

All contributions and ideas are welcome and well received. Please send us your PRs, and we will revise them as soon as possible.

License

This project is under an MIT-License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nicellm-0.0.2.tar.gz (4.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page