Building applications with LLMs through composability https://github.com/hwchase17/langchain

天问 1ea100d806 Update 'README.md' 2 years ago
README.md 1ea100d806 Update 'README.md' 2 years ago

README.md

langchain

LangChain 为常见应用程序提供标准接口、大量集成和端到端链

pip install langchain
pip install openai
from langchain.vectorstores import FAISS
from langchain import HuggingFaceHub
from langchain.docstore import InMemoryDocstore
from langchain import LLMChain, PromptTemplate
from langchain.llms import BaseLLM
from langchain.vectorstores.base import VectorStore
from langchain.chains.base import Chain
from langchain.experimental import BabyAGI


embeddings_model = HuggingFaceEmbedding.newEmbeddingFunction

embedding_size = 1536
index = faiss.IndexFlatL2(embedding_size)

vectorstore = FAISS(embeddings_model, index, InMemoryDocstore({}), {})

verbose = False

int_max_iterations = input("Enter the maximum number of iterations: (Suggest from 3 and 5) ")
max_iterations = int(int_max_iterations)

max_iterations: Optional[int] =   max_iterations
baby_agi = BabyAGI.from_llm(
    llm=llm, vectorstore=vectorstore, verbose=verbose, max_iterations=max_iterations
)