Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

json-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-autocomplete

Complete unfinished JSON streamed in by LLMs (Like OpenAI's GPT)

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

JSON Autocomplete

Lightweight (1KB) and dependency-free

JSON Autocomplete is designed to complete incomplete JSON strings. It's especially effective for handling partial outputs from Large Language Models (LLMs) like OpenAI's GPT.

Streaming example

Installation

Install using npm:

npm install json-autocomplete

Or using Yarn:

yarn add json-autocomplete

Usage

Import jsonAutocomplete and pass incomplete JSON strings to get them completed:

const jsonAutocomplete = require("json-autocomplete");

// Completing LLM Output
const incompleteLLMOutput = '{"items":[{"name":"Appl';
console.log(jsonAutocomplete(incompleteLLMOutput)); // Outputs: {"items":[{"name":"Appl"}]}

// Handling Incomplete Keys
const incompleteKeyJson = '{"user":{"id":123,"nam';
console.log(jsonAutocomplete(incompleteKeyJson)); // Outputs: {"user":{"id":123}}

Features

  • Optimized for completing JSON from LLMs like OpenAI's GPT.
  • Handles a wide range of incomplete JSON formats.
  • Lightweight (1KB) and dependency-free.

Contributing

Your contributions are welcome! For bug fixes, improvements, or feature additions, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Socials

Follow us on Twitter!

Twitter Follow Twitter Follow

Keywords

JSON

FAQs

Package last updated on 13 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts