-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a16c9b1
commit 500bb47
Showing
5 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "embed_anything" | ||
|
||
version = "0.1.14" | ||
version = "0.1.15" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import embed_anything | ||
from openai import OpenAI | ||
|
||
import os | ||
import time | ||
from pinecone import Pinecone | ||
import numpy as np | ||
|
||
|
||
|
||
data = embed_anything.embed_directory('Vector_database_files\test_paper.pdf', embeder= "OpenAI") | ||
embeddings = np.array([data.embedding for data in data]) | ||
|
||
print(len(data)) | ||
query= embed_anything.embed_query(["what is AI?"], embeder="OpenAI") | ||
|
||
pc = Pinecone(api_key="") | ||
index = pc.Index("anything") | ||
|
||
# for i in range(len(data)): | ||
# index.upsert( | ||
# vectors=[{"id": str(i), "values": data[i].embedding, "metadata": {"text": data[i].text}}] | ||
# ) | ||
|
||
|
||
|
||
def retrieval(query): | ||
query_embedding = embed_anything.embed_query(query, embeder="OpenAI") | ||
return index.query(vector=query_embedding[0].embedding, top_k=2) | ||
|
||
|
||
print(retrieval(["what is AI?"])) |