hhh / tests /test_providers /openai_client.py
github-actions[bot]
Deploy from GitHub Actions (commit: 8b247ffacd77c0672965b8378f1d52a7dcd187ae)
9366995
raw
history blame contribute delete
858 Bytes
import sys
import os
# Add web directory to path (go up from tests/test_providers/ to web/)
web_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, web_dir)
from providers.openai_client import OpenAIClient
from services.key_manager import get_key_manager
def main():
"""Run all tests."""
print("\n" + "🧪 OpenAIClient Test Suite" + "\n")
key_manager = get_key_manager()
test_key = "sk-your-actual-key"
key_manager.set_key("openai", test_key)
client = OpenAIClient()
response = client.chat_completions(
prompt="Say 'Hello, this is a test!' in one sentence.",
)
print("✅ API call successful!")
print(f"Response: {response.output_text}")
print(f"Model: {response.model}")
print(f"Usage: {response.usage}")
if __name__ == "__main__":
main()