Open Source Library for Extending GPT Context Limits & Simple "Runtime Fine-Tuning" on Custom Data

0 replies
QUOTE:

LlamaIndex (GPT Index) is a project that provides a central interface to connect your LLM's (large language models, such as OpenAI's GPT models) with your external data.

A big limitation of LLMs is context size, i.e. OpenAI's Davinci model token limit is 4096 tokens.
Yeah large, but not infinite.

So the ability to feed "knowledge" to LLMs is restricted to this limited prompt size and model weights.

Proposed Solution

That's where the LlamaIndex comes in.
LlamaIndex is a simple, flexible interface between your external data and LLMs.
It resolves the following pain points:

• Provides simple data structures to resolve prompt size limitations;
• Offers data connectors to your external data sources; and
• Offers a comprehensive toolset trading off cost and performance.

How to Start

Required are the OpenAI Python library and your OpenAI API key.
Unless you want to use a different LLM.

Install OpenAI Python package this way:

$ python -m pip install -U openai

Then:

1) Simple Installation Steps for Llama_Index

$ python -m pip install -U llama-index

Or, instal from source:

$ git clone https://github.com/jerryjliu/gpt_index.git
$ cd gpt_index
$ python -m pip install -r requirements.txt
$ python -m pip install .

2) Simple Use Case Example

$ cd examples/paul_graham_essay

# Sample Code to Build & Query Index

## Your my_script.py can have these lines:

from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader('your_directory_containing_y our_documents').load_data()
index = GPTSimpleVectorIndex(documents)
# This builds an index over the documents in the data folder (which in this case just consists of the essay text).

# Then, run the following:
response = index.query("your_query_here_such_as What did the author do growing up?")
print(response)

# And, get back a response similar to the following:

## The author wrote short stories and tried to program on an IBM 1401.

/QUOTE

SOURCE: https://gpt-index.readthedocs.io/en/latest/index.html
#context #custom #data #extending #gpt #library #limits #open #open source #runtime finetuning #simple #source
Avatar of Unregistered

Trending Topics