memory_tools.py
Source: sunholo/vertex/memory_tools.py
Functions
get_google_search_grounding(vector_name: str = None, config: sunholo.utils.config_class.ConfigManager = None)
No docstring available.
get_vertex_memories(config: sunholo.utils.config_class.ConfigManager)
Retrieves a LlamaIndex corpus from Vertex AI based on the provided Google Cloud configuration.
This function constructs a corpus name using project details from the configuration and attempts to fetch the corresponding corpus. If the corpus cannot be retrieved, it raises an error.
Parameters:
- vector_name: The name of the of VAC
Returns:
- List of corpus objects fetched from Vertex AI.
Raises:
- ValueError: If any of the required configurations (project_id, location, or rag_id) are missing, or if the corpus cannot be retrieved.
Example:
# Fetch the corpus
try:
corpus = get_corpus("edmonbrain")
print("Corpus fetched successfully:", corpus)
except ValueError as e:
print("Error fetching corpus:", str(e))
print_grounding_response(response)
Prints Gemini response with grounding citations.