test retrieve file

This commit is contained in:
Ishaan Jaff 2024-07-10 15:00:27 -07:00
parent efca9daf5d
commit 5187569e11

View file

@ -1,22 +1,26 @@
# What is this?
## Unit Tests for OpenAI Batches API
import sys, os, json
import traceback
import asyncio
import json
import os
import sys
import traceback
from dotenv import load_dotenv
load_dotenv()
sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
import pytest, logging, asyncio
import litellm
from litellm import (
create_batch,
create_file,
)
import asyncio
import logging
import time
import pytest
import litellm
from litellm import create_batch, create_file
def test_create_batch():
"""
@ -144,6 +148,13 @@ async def test_async_create_batch():
print("file content = ", file_content)
# file obj
file_obj = await litellm.afile_retrieve(
file_id=batch_input_file_id, custom_llm_provider="openai"
)
print("file obj = ", file_obj)
assert file_obj.id == batch_input_file_id
# # write this file content to a file
# with open("file_content.json", "w") as f:
# json.dump(file_content, f)