Electro-Sutra / test_openai_init.py
RohanAi's picture
Upload 11 files
8feda73 verified
raw
history blame contribute delete
633 Bytes
import openai
print('openai module file =', getattr(openai, '__file__', 'builtin'))
# Create a client using the new constructor style. Use a dummy API key (do not print it).
client = openai.OpenAI( base_url='https://api.ai.it.ufl.edu')
print('client created:', type(client))
# Sanity-check attributes exist (don't call network)
has_chat = hasattr(client, 'chat')
print('client has chat attribute:', has_chat)
try:
has_completions = hasattr(client.chat, 'completions')
print('client.chat has completions attribute:', has_completions)
except Exception as e:
print('Could not introspect client.chat:', e)