Skip to content

Evref-BL/Pharo-LLMAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Pharo LLM API

Installation

Metacello new
  githubUser: 'Evref-BL' project: 'Pharo-LLMAPI' commitish: 'main' path: 'src';
  baseline: 'LLMAPI';
  load

Example

For the chat

api := LLMAPI chat.
api host: 'api.mistral.ai'.
api apiKey: '<apiKey>'.

api payload
	temperature: 0.5;
	model: 'mistral-small-latest';
	top_p: 1;
	max_tokens: 250;
	messages: {
		LLMAPIChatObjectMessage role: 'system' content: 'You are a usefull assistant'.
		LLMAPIChatObjectMessage role: 'user' content: 'How to write hello world in Pharo?'.
		 }.

result := api performRequest.
resultContent := result choices anyOne message content.

For the FIM

api := LLMAPI fim.
api host: 'api.mistral.ai'.
api apiKey: '<apiKey>'.

api payload
	temperature: 0.2;
	model: 'codestral-2405';
	top_p: 1;
	max_tokens: 250;
	prompt: 'def';
	suffix: 'return a + b'.
result := api performRequest.
resultContent := result choices anyOne message content.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published