joeyanuff commited on
Commit
51e904b
·
1 Parent(s): 27ba306

code shuffle

Browse files
Files changed (1) hide show
  1. app.py +34 -9
app.py CHANGED
@@ -12,6 +12,16 @@ from langchain.chains import ConversationChain
12
  from langchain.retrievers.self_query.base import SelfQueryRetriever
13
  from langchain.chains.query_constructor.base import AttributeInfo
14
 
 
 
 
 
 
 
 
 
 
 
15
  metadata_field_info=[
16
  AttributeInfo(
17
  name="author",
@@ -30,18 +40,33 @@ metadata_field_info=[
30
  ),
31
  ]
32
 
33
- document_content_description = "Excerpt's from Reid Hoffman's book Impromptu"
34
- embeddings = OpenAIEmbeddings()
35
-
36
- pinecone.init(
37
- api_key=str(os.environ['PINECONE_API_KEY']),
38
- environment=str(os.environ['PINECONE_ENV']))
39
 
40
- index_name = str(os.environ['PINECONE_INDEX_NAME'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  def load_chain():
43
- vectorstore = Pinecone.from_existing_index(index_name, embeddings)
44
- llm = OpenAI(temperature=0)
45
  retriever = SelfQueryRetriever.from_llm(
46
  llm,
47
  vectorstore,
 
12
  from langchain.retrievers.self_query.base import SelfQueryRetriever
13
  from langchain.chains.query_constructor.base import AttributeInfo
14
 
15
+ pinecone.init(
16
+ api_key=str(os.environ['PINECONE_API_KEY']),
17
+ environment=str(os.environ['PINECONE_ENV']))
18
+
19
+ llm = OpenAI(temperature=0)
20
+ embeddings = OpenAIEmbeddings()
21
+ vectorstore = Pinecone.from_existing_index("impromptu", embeddings)
22
+ document_content_description = ("Excerpts from the book Impromptu, "
23
+ "jointly authored by Reid Hoffman, "
24
+ "GPT-3, and GPT 4.")
25
  metadata_field_info=[
26
  AttributeInfo(
27
  name="author",
 
40
  ),
41
  ]
42
 
 
 
 
 
 
 
43
 
44
+ # metadata_field_info=[
45
+ # AttributeInfo(
46
+ # name="author",
47
+ # description="The author of the excerpt",
48
+ # type="string or list[string]",
49
+ # ),
50
+ # AttributeInfo(
51
+ # name="chapter_number",
52
+ # description="The chapter number of excerpt",
53
+ # type="integer",
54
+ # ),
55
+ # AttributeInfo(
56
+ # name="chapter_name",
57
+ # description="The chapter name of the excerpt",
58
+ # type="string",
59
+ # ),
60
+ # ]
61
+
62
+ # document_content_description = "Excerpt's from Reid Hoffman's book Impromptu"
63
+ # embeddings = OpenAIEmbeddings()
64
+
65
+ # index_name = str(os.environ['PINECONE_INDEX_NAME'])
66
 
67
  def load_chain():
68
+ # vectorstore = Pinecone.from_existing_index(index_name, embeddings)
69
+ # llm = OpenAI(temperature=0)
70
  retriever = SelfQueryRetriever.from_llm(
71
  llm,
72
  vectorstore,