|
@@ -6,5 +6,36 @@ pip install langchain
|
|
pip install openai
|
|
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
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|