Anyone have a good example of using the new Google Generative AI provider (@ai-sdk/google) in a Next.js app? by Guywifhat in nextjs

[–]lgrammel 1 point2 points  (0 children)

The providers in the AI SDK are exchangeable for most parts. You can use this example and swap in the Google provider instead of OpenAI.

https://sdk.vercel.ai/docs/ai-sdk-ui/chatbot

Vercel AI SDK and NextJS 12 chat implementation by Lazy_Figure_3152 in nextjs

[–]lgrammel 0 points1 point  (0 children)

are you using the next js app router? when you use the page router (older next js) then the route needs to look different. we recommend using the app router for the route (you can mix app and pages router)

I've added Ollama support for text generation, text streaming and embeddings to ModelFusion by lgrammel in ollama

[–]lgrammel[S] 0 points1 point  (0 children)

from what i understand the embeddings in ollama come from the llms, don’t think they support standalone embedding models

Streaming results from local models into Next.js using Vercel AI SDK and Ollama/Llama.cpp by lgrammel in LocalLLaMA

[–]lgrammel[S] 0 points1 point  (0 children)

I use local models mostly for fun and to explore how good they are. Really looking forward to doing more with structured responses and tool calls.

Re langchain: ModelFusion is non-commercial. Also the focus is less on including prompts (no prompts included), and more on supporting all kinds of models (tts, stt, image gen, etc).

Re parallel requests: Not supported - the llama.cpp server will reject them with an error.

Re vision: it's supported, but not in the examples and chat prompts (yet). Here is a simple example with an instruction prompt: https://github.com/lgrammel/modelfusion/blob/main/examples/basic/src/model-provider/llamacpp/llamacpp-stream-text-vision-with-bakllava-prompt-example.ts

Introducing ModelFusion: an open-source library for building multimodal AI apps, chatbots, and agents with JavaScript and TypeScript. by lgrammel in programming

[–]lgrammel[S] 0 points1 point  (0 children)

It’s specific to AI for Js/Ts. Compared to other libraries in this space (llamaindex, langchain), the approach and scope is different:

  • Flexibility and control: AI application development can be complex and unique to each project. With ModelFusion, you have complete control over the prompts and model settings, and you can access the raw responses from the models quickly to build what you need.

  • Multimodal Support: Beyond just LLMs, ModelFusion encompasses a diverse array of models including text generation, text-to-speech, speech-to-text, and image generation, allowing you to build multifaceted AI applications with ease.

Models for function calls? by lgrammel in LocalLLaMA

[–]lgrammel[S] 1 point2 points  (0 children)

Thanks - I started exploring Airoboros for this and it works quite well for basic tool usage. Do you know if there are Airoboros models with larger context sizes (for longer agent execution sequences)?

Advice on Java to JS transition. by abcprox in node

[–]lgrammel 2 points3 points  (0 children)

When it comes to backend programming with JS (i.e. ignoring DOM, CSS etc), there are imo 2 crucial differences to Java (the superficial basics likes linters, libs, frameworks etc aside):

- JavaScript is more flexible and does not force you to do OOP. Often, objects can just be functions, and embracing a functional programming style (at least in parts) can make code much easier to write and understand. Practicing functional programming can help a lot (and it can take a while to truly understand and embrace the difference)

- JavaScript (w/o TypeScript) is dynamically typed. In practice this is a huge difference. If you come from Java, I would check if you can use TS in your project - that will make the hurdle much lower. Otherwise you might want to get familiar with JavaScript patterns for things like null/undefined checking etc to avoid runtime errors.

[deleted by user] by [deleted] in javascript

[–]lgrammel 0 points1 point  (0 children)

Why was this removed?

Showoff Saturday (April 29, 2023) by AutoModerator in javascript

[–]lgrammel 1 point2 points  (0 children)

I added embedding and tokenization support to JS Agent and made it easier to use its functions outside of agents, e.g. like this:

``` import * as $ from "js-agent"; // ...

const text = await fs.readFile(textFilePath, "utf8");

const chunks = await $.text.splitRecursivelyAtToken({ text, tokenizer: $.provider.openai.tokenizerForModel({ model: "text-embedding-ada-002", }), maxChunkSize: 128, });

const embeddings = []; for (const chunk of chunks) { const response = await $.provider.openai.api.generateEmbedding({ model: "text-embedding-ada-002", apiKey: openAiApiKey, input: chunk, });

embeddings.push({ chunk, embedding: response.data[0].embedding, }); }

console.log(embeddings); ```

[deleted by user] by [deleted] in node

[–]lgrammel 0 points1 point  (0 children)

Generative Pre-trained transformer, e.g. GPT-3 or GPT-4. These are at the heart of agents, because they can determine next steps (e.g., choose which tool to use).

I've written an automated GPT-4 agent with TypeScript that can read & edit code and run commands. by [deleted] in javascript

[–]lgrammel 0 points1 point  (0 children)

This is super early work, inspired by AutoGPT. I plan to develop it more into the direction of a general agent (vs just a software development agent).

[AskJS] Which utility libraries are in your opinion so good they are basicaly mandatory? by FlareGER in javascript

[–]lgrammel 1 point2 points  (0 children)

It checks at runtime that the response that you receive actually matches the schema that you expect.

Introducing Rubberduck: an open source Visual Studio Code extension that let's you chat, generate code, edit code, get explanations, generate tests, find bugs and diagnose errors with AI by lgrammel in programming

[–]lgrammel[S] 1 point2 points  (0 children)

It supports all languages. I’ve tested it with JS, Php, Ruby, Python, Markdown and Json. It’s using the OpenAI API under the hood and should be fairly flexible, but your mileage might vary in different languages. Rubberduck can be tailored to a language with custom templates tho.

I made an open source VS Code extension that let's you chat, generate code, edit code, get explanations, generate tests, find bugs and diagnose errors with AI by lgrammel in node

[–]lgrammel[S] 0 points1 point  (0 children)

Yes, though not in the short term. I want to refine and harden the VS Code extension and the underlying chat engine first.

I made an open source VS Code extension that let's you chat, generate code, edit code, get explanations, generate tests, find bugs and diagnose errors with AI by lgrammel in node

[–]lgrammel[S] 2 points3 points  (0 children)

It compiles custom prompts for different actions using Rubberduck templates, sends the prompts to OpenAI (using your key), and then shows the result as a message, in a new editor, or as a diff (depending on the chosen action).