mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-06 10:54:29 +00:00
- from GPTSimpleVectorIndex to GPTVectorIndex
This commit is contained in:
parent
3a41904a32
commit
0227a2a05c
@ -5,7 +5,7 @@ import gradio as gr
|
|||||||
from langchain.agents import AgentType, initialize_agent, load_tools
|
from langchain.agents import AgentType, initialize_agent, load_tools
|
||||||
from llama_index import (
|
from llama_index import (
|
||||||
Document,
|
Document,
|
||||||
GPTSimpleVectorIndex,
|
GPTVectorStoreIndex,
|
||||||
LangchainEmbedding,
|
LangchainEmbedding,
|
||||||
LLMPredictor,
|
LLMPredictor,
|
||||||
ServiceContext,
|
ServiceContext,
|
||||||
@ -33,7 +33,7 @@ def knowledged_qa_demo(text_list):
|
|||||||
service_context = ServiceContext.from_defaults(
|
service_context = ServiceContext.from_defaults(
|
||||||
llm_predictor=llm_predictor, embed_model=embed_model
|
llm_predictor=llm_predictor, embed_model=embed_model
|
||||||
)
|
)
|
||||||
index = GPTSimpleVectorIndex.from_documents(
|
index = GPTVectorStoreIndex.from_documents(
|
||||||
documents, service_context=service_context
|
documents, service_context=service_context
|
||||||
)
|
)
|
||||||
return index
|
return index
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader
|
from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader
|
||||||
|
|
||||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
||||||
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
|
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
|
||||||
@ -13,7 +13,7 @@ logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
|
|||||||
documents = SimpleDirectoryReader("data").load_data()
|
documents = SimpleDirectoryReader("data").load_data()
|
||||||
# split the document to chunk, max token size=500, convert chunk to vector
|
# split the document to chunk, max token size=500, convert chunk to vector
|
||||||
|
|
||||||
index = GPTSimpleVectorIndex(documents)
|
index = GPTVectorStoreIndex(documents)
|
||||||
|
|
||||||
# save index
|
# save index
|
||||||
index.save_to_disk("index.json")
|
index.save_to_disk("index.json")
|
||||||
|
@ -6,7 +6,7 @@ from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
|||||||
from langchain.llms.base import LLM
|
from langchain.llms.base import LLM
|
||||||
from llama_index import (
|
from llama_index import (
|
||||||
GPTListIndex,
|
GPTListIndex,
|
||||||
GPTSimpleVectorIndex,
|
GPTVectorStoreIndex,
|
||||||
LangchainEmbedding,
|
LangchainEmbedding,
|
||||||
LLMPredictor,
|
LLMPredictor,
|
||||||
PromptHelper,
|
PromptHelper,
|
||||||
|
Loading…
Reference in New Issue
Block a user