Giter Club home page Giter Club logo

ai-book's Introduction

LLMBook README

Interact with LLM's via VS Code notebooks.

To begin, make a *.llm file and this extension will automatically take it from there.

Note: You can also use *.llm.json file, which functions identically but allows importing into scripts without needing to specifically configure a loader.

As compared to ChatGPT where you only have control over the user message, this allows for precisely tuning all of the system, user, and assistant messages to best suit the task at hand (aka "Prompt Engineering"):

example of overriding the assistant's response example of overriding the assistant's response example of overriding the assistant's response

Fun fact! The .llm format used by notebooks is on-disk represented in the official OpenAI "Chat Format" as JSON, meaning the tuned prompt notebook files can be loaded straight from disk and incorporated with the rest of your pipeline.

Pricing

The extension is free to use. OpenAI isn't. Configure llm-book.openAI.dollarsPerKiloToken to show how much a given cell or notebook will cost to execute. Configure llm-book.openAI.showTokenCount to hide the token counts on cells and notebooks.

LLaMa?

There is initial support for LLaMa models (anything CLI-powered, really) but it's wonky (the prompt is echoed back in the response, for one). Also, the base LLaMa models aren't well suited for conversational settings, and do not support the system, user, assistant breakdown. If you are interested in furthering this support, PR's are more than welcome. Set llm-book.LLaMa.binary to begin.

OpenAI?

By default the extension queries against OpenAI APIs (https://api.openai.com/v1/chat/completions), however this is easily configured via the llm-book.openAI.endpoint setting. Your API key is added in the notebook's controls.

ai-book's People

Contributors

ashcoolman avatar jacksonkearl avatar msnidal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ai-book's Issues

Setting the endpoint parameter breaks the extension.

If the endpoint parameter is set to anything including OpenAI's current endpoint" https://api.openai.com/v1/chat/completions" The extension fails to work. It doesn't even attempt to talk to the address provided, just errors with:

Error: Error accessing OpenAI. The "Update OpenAPI Api Key" command may help you.
undefined
	at [/home/luk/.vscode/extensions/jaaxxx.llm-book-0.1.1/dist/extension.js:1:4704](https://file+.vscode-resource.vscode-cdn.net/home/luk/.vscode/extensions/jaaxxx.llm-book-0.1.1/dist/extension.js:1:4704)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async Object.<anonymous> (/home/luk/.vscode/extensions/jaaxxx.llm-book-0.1.1/dist/extension.js:1:2494)
	at async n.$executeCells (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:96089)

I know this is not an API key issue as when I delete the endpoint it works fine. This also prevents use of any local OpenAI api endpoints.

I don't know why would it fail as the code seems to set the endpoint to the same value, but it fails nevertheless.Screenshot attached.
Screenshot from 2024-01-02 15-54-11

For some reason chaning the parameter in the settings GUI works fine, but using the Configure LLM button and inputting wia the command box results with the error above.

Furthermore, if it was possible to set this (as well as other settings and parameters) on a per document basis that would be great.

GPT-4?

How do I switch to GPT-4?

Add markdown language highlighting to system/user/assistant languages

Hello, thanks for this extension I'm finding this to actually be an incredible alternative to using chatgpt for coding, in particular having copilot, my vim keybindings and the ability to edit the conversation thread is all actually really great.

One quirk of the notebook format is the built-in markdown mode, which is ignore from what I can tell when constructing the messages. I understand the logic here, but also found that the markdown syntax highlighting is really nice for the prompts themselves, especially supporting Markdown code blocks like:

def my_function() -> int:
  return 42

I'm therefore copying the markdown tmLanguage.json file and trying to get the custom languages to inherit from it. Ideally I will also be able to disable the markdown mode after this to reduce confusion, will try and follow up with a PR soon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.