Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local AI model inference #522

Draft
wants to merge 181 commits into
base: dev
Choose a base branch
from
Draft

Local AI model inference #522

wants to merge 181 commits into from

Conversation

lucksus
Copy link
Member

@lucksus lucksus commented Sep 5, 2024

This adds AI model inference to ADAM, including downloading and managing of models from Huggingface, registering tasks and prompting models - based on Kalosm.

As a first step, this PR only focusses on managing and making available a couple of hard-coded models, but introducing an new section "AI" to the Ad4mClient. Other, future PRs will add the ability to have the user select and manage the exact models (#504), as well as registering external modals via API, and UI in the ADAM Launcher for all of this.

New AI interface functions in Ad4mClient

This introduced 3 different kinds of model interactions that ADAM provides to apps via it's interface

Language processing with LLMs via tasks

const task = await ad4mClient.ai.addTask(
  //Model name, currently irrelevant with hard-coded model,
  "Llama", 
  //System prompt
  "You analyse incoming text for topics and respond with a JSON array including the topic names", 
  // Examples
  [
    {
      input: "Hey guys, how is it going?",
      output: '["greeting"]'
    },
    {
      input: "I really want to try the new Synergy plugin in Flux",
      output: '["testing", "Synergy", "Flux"]'
    },
  ]
);

This spawns a session of the given model and configures it with the prompt and the examples, so that subsequently it can be run with:

const answer = await ad4mClient.ai.prompt(task.taskId, "Hello there, yeah I also would like to test that plugin!")

Emedding of text

const vector = await ad4mClient.ai.embed("Bert", "This is a test string");

Transcription of audio

const streamId = await ad4mClient.ai.openTranscriptionStream("Whisper", (text) => {
  console.log(text);
  });
  
// Feed raw sample data (float 32)
await ad4mClient.ai.feedTranscriptionStream(streamId, [0, 10, 20, 30]);

Progress

  • ADAM interface/client definitions
  • Task CRUD
  • Task execution
  • Embedding vectors
  • Audio transcription

lucksus and others added 30 commits October 30, 2023 11:49
# Conflicts:
#	cli/Cargo.toml
#	cli/src/main.rs
fayeed and others added 30 commits October 4, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants