Files
railseek6/debug_deepseek_config.py

76 lines
2.4 KiB
Python

import requests
import json
import os
def debug_deepseek_config():
"""Debug the DeepSeek configuration being used by the server"""
base_url = "http://localhost:3015"
# Test login first
login_data = {
"username": "jleu3482",
"password": "jleu1212"
}
print("Logging in to get server configuration...")
login_response = requests.post(
f"{base_url}/login",
data=login_data,
headers={"Content-Type": "application/x-www-form-urlencoded"}
)
if login_response.status_code != 200:
print(f"❌ Login failed: {login_response.status_code}")
return
token = login_response.json().get("access_token")
headers = {"Authorization": f"Bearer {token}"}
# Get health endpoint to see current configuration
print("\nGetting server health configuration...")
health_response = requests.get(f"{base_url}/health", headers=headers)
if health_response.status_code == 200:
health_data = health_response.json()
print("✅ Server health configuration:")
print(json.dumps(health_data["configuration"], indent=2))
# Check environment variables
print("\n=== Environment Variables ===")
env_vars = [
"OPENAI_API_KEY", "OPENAI_BASE_URL", "DEEPSEEK_API_KEY",
"LLM_BINDING", "LLM_MODEL", "EMBEDDING_MODEL"
]
for var in env_vars:
value = os.getenv(var, "NOT SET")
print(f"{var}: {value}")
# Test a simple search to see the exact error
print("\n=== Testing Search with Current Config ===")
search_data = {
"query": "test query",
"top_k": 1
}
search_response = requests.post(
f"{base_url}/search",
json=search_data,
headers=headers
)
print(f"Search response status: {search_response.status_code}")
if search_response.status_code != 200:
print(f"Search error: {search_response.text}")
# Try to parse the error
try:
error_data = search_response.json()
print(f"Error details: {json.dumps(error_data, indent=2)}")
except:
print("Could not parse error as JSON")
else:
print(f"❌ Health check failed: {health_response.status_code}")
if __name__ == "__main__":
debug_deepseek_config()