npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mongosh/snippet-llm-command

v0.0.9

Published

Provides a llm command to ask for MongoDB query expressions in natural language, using Groq or any other local model (ollama)

Downloads

14

Readme

LLM Command Snippet

This snippet adds an llm command to mongosh that provides helpful suggestions or recommendations for MongoDB-related tasks. The query results are generated using Groq API by default, with an option to use other models via Ollama.

Prerequisites

export GROQ_API_KEY=gsk_XXXXXXX
mongosh

Usage

After installing the snippet, you can use the llm command in your MongoDB shell like this:

llm("very briefly, just the command, do not use markdown: in mongosh how to get the collections names of current db?");

This will output a possible solution to your query, such as db.getCollectionNames().

llm("very briefly, just the command, do not use markdown: in mongosh replace all documents of a collection with property {'set':'llm102'} with the new value {'set':'llm101'} in current db?")

This will output a possible solution to your query, such as db.collection.updateMany({ set: 'llm102' }, { $set: { set: 'llm101' } }).

You can also specify a different model to use with an optional parameter:

llm("Your query here", { model: "phi3.5" });

This will use the specified model (in this case, 'phi3.5') via Ollama instead of the default Groq API.

Models

By default, the llm command uses the Groq API with the 'llama-3.1-70b-versatile' model. You can use other models by specifying them in the optional parameter:

  • Groq API (default): No need to specify, just use llm("Your query").
  • Ollama models: Specify the model name, e.g., llm("Your query", { model: "gemini2" }) or llm("Your query", { model: "phi3.5" }).

Note: When using Ollama models, make sure you have Ollama running locally on the default port (11434).

Installation

You can install this snippet using the snippet command in mongosh:

snippet install llm-command

Troubleshooting

If you get the error:

"Error: Cannot find module 'groq-sdk'"

then, go to your $USER/.mongodb/mongosh/snippets/node_modules/@juananpe/snippets-llm-command folder and run npm install. Then close and open mongosh again.

License

This snippet is licensed under the Apache-2.0 license.