Spaces:
Running
Running
increase top_k
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ INDEX_NAME = 'realvest-data-v2'
|
|
10 |
EMBEDDING_MODEL = "text-embedding-ada-002" # OpenAI's best embeddings as of Apr 2023
|
11 |
MAX_LENGTH_DESC = 200
|
12 |
MATCH_SCORE_THR = 0.0
|
|
|
13 |
|
14 |
def test_pinecone(sleep_time: int=1):
|
15 |
MAX_TRIALS = 5
|
@@ -99,7 +100,7 @@ if st.button('Submit'):
|
|
99 |
# ### call OpenAI text-embedding
|
100 |
res = openai.Embedding.create(model=EMBEDDING_MODEL, input=[query], api_key=OPENAI_API_KEY)
|
101 |
xq = res['data'][0]['embedding']
|
102 |
-
out = query_pinecone(xq, top_k=
|
103 |
|
104 |
### candidates
|
105 |
metadata = {match['metadata']['product_id']: match['metadata'] for match in out['matches']}
|
|
|
10 |
EMBEDDING_MODEL = "text-embedding-ada-002" # OpenAI's best embeddings as of Apr 2023
|
11 |
MAX_LENGTH_DESC = 200
|
12 |
MATCH_SCORE_THR = 0.0
|
13 |
+
TOP_K = 20
|
14 |
|
15 |
def test_pinecone(sleep_time: int=1):
|
16 |
MAX_TRIALS = 5
|
|
|
100 |
# ### call OpenAI text-embedding
|
101 |
res = openai.Embedding.create(model=EMBEDDING_MODEL, input=[query], api_key=OPENAI_API_KEY)
|
102 |
xq = res['data'][0]['embedding']
|
103 |
+
out = query_pinecone(xq, top_k=TOP_K, include_metadata=True)
|
104 |
|
105 |
### candidates
|
106 |
metadata = {match['metadata']['product_id']: match['metadata'] for match in out['matches']}
|