Uploading Files
Get File
Get File Content
ListFiles
endpoint is not supported for Vertex AI.Upload files to Google Cloud Storage for Vertex AI fine-tuning and batch inference
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
provider="@VERTEX_PROVIDER",
vertex_storage_bucket_name="your_bucket_name", # Specify the GCS bucket name
provider_file_name="your_file_name.jsonl", # Specify the file name in GCS
provider_model="gemini-1.5-flash-001" # Specify the model to use
)
upload_file_response = portkey.files.create(
purpose="fine-tune", # Can be "fine-tune" or "batch"
file=open("dataset.jsonl", "rb")
)
print(upload_file_response)
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
provider="@VERTEX_PROVIDER"
)
file = portkey.files.retrieve(file_id="file_id")
print(file)
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
provider="@VERTEX_PROVIDER"
)
file_content = portkey.files.content(file_id="file_id")
print(file_content)
ListFiles
endpoint is not supported for Vertex AI.Was this page helpful?