38 lines
981 B
Python
38 lines
981 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script for connecting to LM Studio.
|
|
"""
|
|
|
|
from config import Config
|
|
from llm_client import LLMClient
|
|
|
|
|
|
def test_connection():
|
|
"""Test the connection to LM Studio."""
|
|
print("Testing connection to LM Studio...")
|
|
print("-" * 30)
|
|
|
|
# Create config and client
|
|
config = Config()
|
|
llm_client = LLMClient(config)
|
|
|
|
# Display connection details
|
|
print(f"Host: {config.LM_STUDIO_HOST}")
|
|
print(f"Port: {config.LM_STUDIO_PORT}")
|
|
print(f"API URL: {config.get_api_url()}")
|
|
print(f"Chat Completions URL: {config.get_chat_completions_url()}")
|
|
print()
|
|
|
|
# Test connection
|
|
try:
|
|
success = llm_client.test_connection()
|
|
if success:
|
|
print("✓ Connection to LM Studio successful!")
|
|
else:
|
|
print("✗ Failed to connect to LM Studio")
|
|
except Exception as e:
|
|
print(f"✗ Error testing connection: {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_connection() |