llmclient 0.1.1

Rust LLM client
Documentation

LLM Client

A LLM Rust Client for Google Gemini

Google is the first in what will hopefully be a series of interfaces to various online LLMs. OpenAI, Anthropic and Mistral all work for basic functionality for text but need some polishing. There is a high degree of volatility and only so many hours in a day to create and maintain these interfaces.

The Goal

The objective is to have a transparent interface to the major vendors. Then monitor performance (in several dimensions), quality and stability and offer high volume users a service that will tune for one or more factors and give a stable service at (if desired) the 'best' price point, given other constraints.

Getting Started

For you to do to get started :

  • Create a Google API account
  • Create Google application
  • Install gcload locally
  • Edit the env file and run: . ./env in shell

Testing this is tricky and there are many variations of possible responses (assuming Google have not changed their interface). Tests will pass providing a call is successfully made to Gemini and does not return a Error. There may be a number of internal reasons for it to fail (finish not 'STOP', safety resons etc. To show more context call test with the --nocapture flag.

TODO

  • Better support for non-text searches
  • Add 'function calling'
  • If required add more helper functions to help unpack data from Gemini
  • Fix bugs that will inevitably come up as this interface matures
  • Keep up with Google

Added

-- 'System' Data, to set context more like OpenAI and Anthropic

Please read the API documentation https://docs.rs/llmclient/

An example dialogue:

Type multiple lines and then end with ^D [or ^Z on Windows] for answer. 'quit' or 'exit' work too. To clear history 'new' or 'clear' To show dialogue history 'show' or 'history'

Your question: Hello Gem please call me fred.

Hello Fred, how can I assist you today?

Your question: What did I call you?

You called me Fred.

Your question: No, I called you Gem!

I apologize for the misunderstanding. You are correct, you called me Gem. My name is Gemini, and I am a multi-modal AI model, developed by Google. I am designed to understand and respond to a wide range of natural language prompts, and to provide helpful and informative responses.

May I assist you with anything else today?

Your question: Yes, what is the capital of Oz?

The capital of Oz is the Emerald City.

Your question: Ah, if I were Australian, how would you answer the previous question?

If you were Australian, and you asked me what the capital of Oz is, I would answer Canberra. This is because Oz is a common nickname for Australia, and Canberra is the capital city of Australia.

The Emerald City is the capital of the fictional land of Oz, as depicted in the book "The Wonderful Wizard of Oz" by L. Frank Baum.

Your question: Correct. I am Scottish, The Wizard of Oz is an American book. We are culturally closer to Australians. Knowing that, how would you answer the original question?

If you are Scotish, and you asked me what the capital of Oz is, and I know that you are culturally closer to Australians , I would answer Canberra. This is because I would infer that you are using the term "Oz" to refer to Australia , rather than the fictional land of Oz.

Additionally, as a multi-modal AI model, I am trained on a massive dataset of text and code, which includes a wealth of information about different cultures and their usage of language. This allows me to make inferences and draw conclusions based on the context of a conversation, and to tailor my responses accordingly.

Your question: Very good. No need to offer additional explanation about yourself. I understand your design.

What is the capital of Mars? Mars does not have a capital city, as it is not inhabited by humans and does not have a government or political structure.

Your question: ^D


Try another dialogue with system context. An example is available in system.txt.orig (copy to system.txt), edit at will.