/llm-extract-structured-information-langchain-kor

Very simple sample that extracts JSON based on a schema from human text input.

Primary LanguageHTMLMIT LicenseMIT

Extract structured data from human input text with an LLM

A demo that illustrates how to use Kor to fill in form fields from a user's request. This can be useful, for example, to define filter settings using natural language.

Schema

The JSON schema for Kor is defined in the file schema.json. See also Schema from JSON.

Client

The client frontend was created with GPT Engineer. The prompt for it is in the file prompt. The client can be started by opening the file index.html in a browser.

Server

The server is a Python FastAPI that accepts a query via HTTP Post at /query. The result of the call is the parsed request. An example request is located in the file requests.http

NOTE: Make sure to provide the OpenAI API key in an environment variable called OPENAI_API_KEY.

The server can be started as follows:

python ./server/server.py