Ecosystem
LLMs
- Overview
- OpenAI
- Anthropic
- Google Gemini
- Google Vertex AI
- Azure
- Bedrock
- AWS SageMaker
- Ollama
- More
- Bring Your Own LLM
OpenAI
Files
Upload files to OpenAI
Uploading Files
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
upload_file_response = client.files.create(
purpose="batch",
file=open("file.pdf", "rb")
)
print(upload_file_response)
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
upload_file_response = client.files.create(
purpose="batch",
file=open("file.pdf", "rb")
)
print(upload_file_response)
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='OPENAI_API_KEY',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="OBIGUARD_API_KEY"
)
)
upload_file_response = client.files.create(
purpose="batch",
file=open("file.pdf", "rb")
)
print(upload_file_response)
List Files
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
files = client.files.list()
print(files)
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
files = client.files.list()
print(files)
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='OPENAI_API_KEY',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="OBIGUARD_API_KEY"
)
)
files = openai.files.list()
print(files)
Get File
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
file = client.files.retrieve(file_id="file_id")
print(file)
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
file = client.files.retrieve(file_id="file_id")
print(file)
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='OPENAI_API_KEY',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="OBIGUARD_API_KEY"
)
)
file = client.files.retrieve(file_id="file_id")
print(file)
Get File Content
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
file_content = client.files.content(file_id="file_id")
print(file_content)
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
file_content = client.files.content(file_id="file_id")
print(file_content)
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='OPENAI_API_KEY',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="OBIGUARD_API_KEY"
)
)
file_content = openai.files.content(file_id="file_id")
print(file_content)
Delete File
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
delete_file_response = client.files.delete(file_id="file_id")
print(delete_file_response)
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="OBIGUARD_API_KEY", # Your Obiguard API key
)
delete_file_response = client.files.delete(file_id="file_id")
print(delete_file_response)
Copy
from openai import OpenAI
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='OPENAI_API_KEY',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="OBIGUARD_API_KEY"
)
)
delete_file_response = client.files.delete(file_id="file_id")
print(delete_file_response)
Assistant
Responses are generated using AI and may contain mistakes.