from cerebras.cloud.sdk import Cerebras
import os
client = Cerebras(
api_key=os.environ.get("CEREBRAS_API_KEY"),
)
content = client.files.retrieve_content("file_123")
# Save to file
with open("downloaded-file.jsonl", "wb") as f:
f.write(content)
print("File downloaded successfully")
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.
from cerebras.cloud.sdk import Cerebras
import os
client = Cerebras(
api_key=os.environ.get("CEREBRAS_API_KEY"),
)
content = client.files.retrieve_content("file_123")
# Save to file
with open("downloaded-file.jsonl", "wb") as f:
f.write(content)
print("File downloaded successfully")
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.
Content-Type header indicates the file type:
application/x-ndjsonfrom cerebras.cloud.sdk import Cerebras
import os
client = Cerebras(
api_key=os.environ.get("CEREBRAS_API_KEY"),
)
content = client.files.retrieve_content("file_123")
# Save to file
with open("downloaded-file.jsonl", "wb") as f:
f.write(content)
print("File downloaded successfully")
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.
Was this page helpful?