Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3cd5106
update product recommendation example description
badmonster0 May 18, 2025
e32cfea
rename folder
badmonster0 May 18, 2025
dddee93
Update README.md
badmonster0 May 18, 2025
e43a28e
Update README.md
badmonster0 May 18, 2025
ade9afb
Update README.md
badmonster0 May 19, 2025
2bead87
Update README.md
badmonster0 May 19, 2025
a374650
update text_embedding with new query handler
badmonster0 May 20, 2025
3df050d
Update main.py
badmonster0 May 20, 2025
0471abe
Update README.md
badmonster0 May 20, 2025
c3c09b0
Update README.md
badmonster0 May 20, 2025
bab25a4
Update README.md
badmonster0 May 20, 2025
4f0b607
Update README.md
badmonster0 May 20, 2025
9ffe7ed
Update README.md
badmonster0 May 20, 2025
631cad7
Update README.md
badmonster0 May 20, 2025
8008d85
Update README.md
badmonster0 May 20, 2025
2aa1bc8
qdrant
badmonster0 May 20, 2025
c76db2d
Update README.md
badmonster0 May 20, 2025
f5e965d
Update README.md
badmonster0 May 20, 2025
eed7a25
Update README.md
badmonster0 May 20, 2025
12fc9be
Update README.md
badmonster0 May 20, 2025
407eda2
Update README.md
badmonster0 May 20, 2025
44d93dd
Update README.md
badmonster0 May 20, 2025
689d359
Update README.md
badmonster0 May 20, 2025
a72270c
Merge branch 'jelly-ex2' of https://github.com/cocoindex-io/cocoindex…
badmonster0 May 20, 2025
eb56fe2
Update main.py
badmonster0 May 20, 2025
e69c212
Update main.py
badmonster0 May 20, 2025
9272a8a
Update main.py
badmonster0 May 20, 2025
7967914
Update main.py
badmonster0 May 20, 2025
35b19ba
Merge branch 'main' into jelly-ex2
badmonster0 May 20, 2025
3577694
upgrade query handling for pdf embedding
badmonster0 May 20, 2025
f127c54
Merge branch 'main' into jelly-ex2
badmonster0 May 20, 2025
9741fa8
Update README.md
badmonster0 May 20, 2025
818b806
Update README.md
badmonster0 May 20, 2025
b5fbae6
Update README.md
badmonster0 May 20, 2025
3ab5ddc
Update README.md
badmonster0 May 20, 2025
58d7cba
Merge branch 'main' into jelly-ex2
badmonster0 May 20, 2025
331e0e2
Merge branch 'main' into jelly-ex2
badmonster0 May 20, 2025
ff43f46
Update main.py
badmonster0 May 20, 2025
55ebc4a
google drive example update query handler
badmonster0 May 20, 2025
a79d279
Merge branch 'main' into jelly-ex2
badmonster0 May 20, 2025
6e72fb2
Update README.md
badmonster0 May 21, 2025
b46cf77
Update README.md
badmonster0 May 21, 2025
d2725e0
Merge branch 'main' into jelly-ex2
badmonster0 May 21, 2025
b874512
rename to image_search (to be more consistent with other examples)
badmonster0 May 21, 2025
2402c78
update query handling for image search
badmonster0 May 21, 2025
87bd37b
Merge branch 'main' into jelly-ex2
badmonster0 May 21, 2025
ac43f78
Update README.md
badmonster0 May 21, 2025
b645bb1
Update README.md
badmonster0 May 21, 2025
979cde9
Merge branch 'main' into jelly-ex2
badmonster0 May 21, 2025
4bc0486
Merge branch 'jelly-ex2' of https://github.com/cocoindex-io/cocoindex…
badmonster0 May 21, 2025
0b5da66
Merge branch 'main' into jelly-ex2
badmonster0 May 21, 2025
32fcd4d
simplify the fast api example
badmonster0 May 21, 2025
5a01dc8
upgrade query handling
badmonster0 May 21, 2025
99a1e38
Update README.md
badmonster0 May 21, 2025
57ac81d
Update README.md
badmonster0 May 21, 2025
d8b364f
fix docker
badmonster0 May 21, 2025
a8e94ba
Update README.md
badmonster0 May 21, 2025
a208c8e
Update README.md
badmonster0 May 21, 2025
12bd609
Merge branch 'main' into jelly-ex2
badmonster0 May 21, 2025
d312bc5
Update Image search project description
badmonster0 May 22, 2025
6e80f35
Merge branch 'main' into jelly-ex2
badmonster0 May 22, 2025
1750b05
Merge branch 'jelly-ex2' of https://github.com/cocoindex-io/cocoindex…
badmonster0 May 22, 2025
7233870
Merge branch 'main' into jelly-ex2
badmonster0 May 22, 2025
f03cde5
simplify main.py for interactive query
badmonster0 May 22, 2025
7374e6a
more
badmonster0 May 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions examples/amazon_s3_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ def _main():
with cocoindex.FlowLiveUpdater(amazon_s3_text_embedding_flow):
# Run queries in a loop to demonstrate the query capabilities.
while True:
try:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
results, _ = query_handler.search(query, 10)
print("\nSearch results:")
for result in results:
print(f"[{result.score:.3f}] {result.data['filename']}")
print(f" {result.data['text']}")
print("---")
print()
except KeyboardInterrupt:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
results, _ = query_handler.search(query, 10)
print("\nSearch results:")
for result in results:
print(f"[{result.score:.3f}] {result.data['filename']}")
print(f" {result.data['text']}")
print("---")
print()

if __name__ == "__main__":
load_dotenv()
Expand Down
23 changes: 10 additions & 13 deletions examples/code_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,17 @@ def _main():
pool = ConnectionPool(os.getenv("COCOINDEX_DATABASE_URL"))
# Run queries in a loop to demonstrate the query capabilities.
while True:
try:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print("\nSearch results:")
for result in results:
print(f"[{result['score']:.3f}] {result['filename']}")
print(f" {result['code']}")
print("---")
print()
except KeyboardInterrupt:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print("\nSearch results:")
for result in results:
print(f"[{result['score']:.3f}] {result['filename']}")
print(f" {result['code']}")
print("---")
print()

if __name__ == "__main__":
load_dotenv()
Expand Down
23 changes: 10 additions & 13 deletions examples/gdrive_text_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,17 @@ def _main():
pool = ConnectionPool(os.getenv("COCOINDEX_DATABASE_URL"))
# Run queries in a loop to demonstrate the query capabilities.
while True:
try:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print("\nSearch results:")
for result in results:
print(f"[{result['score']:.3f}] {result['filename']}")
print(f" {result['text']}")
print("---")
print()
except KeyboardInterrupt:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print("\nSearch results:")
for result in results:
print(f"[{result['score']:.3f}] {result['filename']}")
print(f" {result['text']}")
print("---")
print()

if __name__ == "__main__":
load_dotenv()
Expand Down
13 changes: 5 additions & 8 deletions examples/pdf_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,12 @@ def _main():
pool = ConnectionPool(os.getenv("COCOINDEX_DATABASE_URL"))
# Run queries in a loop to demonstrate the query capabilities.
while True:
try:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print(SEARCH_RESULTS_TEMPLATE.render(results=results))
except KeyboardInterrupt:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print(SEARCH_RESULTS_TEMPLATE.render(results=results))


if __name__ == "__main__":
Expand Down
23 changes: 10 additions & 13 deletions examples/text_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,17 @@ def _main():
pool = ConnectionPool(os.getenv("COCOINDEX_DATABASE_URL"))
# Run queries in a loop to demonstrate the query capabilities.
while True:
try:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print("\nSearch results:")
for result in results:
print(f"[{result['score']:.3f}] {result['filename']}")
print(f" {result['text']}")
print("---")
print()
except KeyboardInterrupt:
query = input("Enter search query (or Enter to quit): ")
if query == '':
break
# Run the query function with the database connection pool and the query.
results = search(pool, query)
print("\nSearch results:")
for result in results:
print(f"[{result['score']:.3f}] {result['filename']}")
print(f" {result['text']}")
print("---")
print()

if __name__ == "__main__":
load_dotenv()
Expand Down
41 changes: 19 additions & 22 deletions examples/text_embedding_qdrant/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,26 @@ def _main():

# Run queries in a loop to demonstrate the query capabilities.
while True:
try:
query = input("Enter search query (or Enter to quit): ")
if query == "":
break

# Get the embedding for the query
query_embedding = text_to_embedding.eval(query)

search_results = client.search(
collection_name=QDRANT_COLLECTION,
query_vector=("text_embedding", query_embedding),
limit=10
)
print("\nSearch results:")
for result in search_results:
score = result.score
payload = result.payload
print(f"[{score:.3f}] {payload['filename']}")
print(f" {payload['text']}")
print("---")
print()
except KeyboardInterrupt:
query = input("Enter search query (or Enter to quit): ")
if query == "":
break

# Get the embedding for the query
query_embedding = text_to_embedding.eval(query)

search_results = client.search(
collection_name=QDRANT_COLLECTION,
query_vector=("text_embedding", query_embedding),
limit=10
)
print("\nSearch results:")
for result in search_results:
score = result.score
payload = result.payload
print(f"[{score:.3f}] {payload['filename']}")
print(f" {payload['text']}")
print("---")
print()


if __name__ == "__main__":
Expand Down