File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ import sys
2+ import os
3+
4+ # Set up path so we can import and run scripts as if they were in the workspace.
5+ sys .path .append (os .getcwd ())
6+
7+ from third_party .py .google .genai import types
8+ from third_party .py .google .genai import models
9+ from third_party .py .google .genai import _common
10+ import json
11+
12+ class MockApiClient :
13+ def __init__ (self ):
14+ self .vertexai = True
15+ self .location = 'us-central1'
16+ self .project = 'test-project'
17+
18+ def test_transformation ():
19+ tool = types .Tool (
20+ retrieval = types .Retrieval (
21+ vertex_rag_store = types .VertexRagStore (
22+ rag_resources = [
23+ types .VertexRagStoreRagResource (
24+ rag_corpus = 'projects/test-project/locations/us-central1/ragCorpora/test-corpus'
25+ )
26+ ],
27+ rag_retrieval_config = types .RagRetrievalConfig (
28+ filter = types .RagRetrievalConfigFilter (
29+ metadata_filter = 'color = "red"' ,
30+ ),
31+ ),
32+ )
33+ ),
34+ )
35+
36+ api_client = MockApiClient ()
37+ # Mocking internal transform
38+ transformed = models ._Tool_to_vertex (api_client , tool )
39+ final_dict = _common .convert_to_dict (transformed )
40+ print (json .dumps (final_dict , indent = 2 ))
41+
42+ if __name__ == '__main__' :
43+ test_transformation ()
You can’t perform that action at this time.
0 commit comments