This file contains hidden or 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
-- Bucket: travel-sample | |
-- Scope: inventory | |
-- Collection: landmark | |
SELECT | |
l.name, | |
l.content, | |
l.price, | |
l.url, | |
l.geo, |
This file contains hidden or 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
def search_restaurants(self, question): | |
vector = self.embeddings_model.embed_query(question) | |
try: | |
search_req = search.SearchRequest.create(search.MatchNoneQuery()).with_vector_search( | |
VectorSearch.from_vector_query(VectorQuery('embedding', vector, num_candidates=3)) | |
) | |
result = self.scope.search( | |
self.search_index, | |
search_req, | |
SearchOptions(limit=13, fields=["name", "content", "phone", "price", "url", "geo.lat", "geo.lon"]) |
This file contains hidden or 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
def couchbase_property_search(vector_store, query, k=5, saved_properties=None): | |
""" | |
Search properties in Couchbase using vector similarity, excluding saved properties. | |
- vector_store: CouchbaseSearchVectorStore instance | |
- query: search string | |
- k: number of results to return | |
- saved_properties: list of dicts (already saved by user) | |
Returns: list of property dicts | |
""" |
This file contains hidden or 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
import tensorflow as tf | |
import tensorflow_hub as hub | |
import numpy as np | |
import soundfile as sf | |
# Load VGGish model from TensorFlow Hub | |
vggish = hub.load('https://tfhub.dev/google/vggish/1') | |
def load_wav_for_vggish(file_path): | |
wav, sr = sf.read(file_path) |