Files
ai-agent-book/chapter1/context/tests/manual/check_kimi_quick.py
T
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

58 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""
Quick test script to verify Kimi K3 model integration
"""
import os
from _bootstrap import add_project_root
add_project_root()
from dotenv import load_dotenv
from agent import ContextAwareAgent, ContextMode
# Load environment variables
load_dotenv()
def main():
# Get API key
api_key = os.getenv("MOONSHOT_API_KEY")
if not api_key:
print("❌ ERROR: MOONSHOT_API_KEY not set")
print("Please add to your .env file:")
print(" MOONSHOT_API_KEY=your_api_key_here")
return
print("🚀 Testing Kimi K3 Model (kimi-k3)")
print("=" * 50)
try:
# Create agent with Kimi provider
agent = ContextAwareAgent(
api_key=api_key,
provider="kimi",
context_mode=ContextMode.FULL,
verbose=False
)
print(f"✅ Agent created successfully")
print(f" Provider: {agent.provider}")
print(f" Model: {agent.model}")
print(f" Base URL: {agent.client.base_url}")
# Test simple query
print("\n📝 Testing basic query...")
query = "What is 2 + 2?"
response = agent.process(query)
print(f" Query: {query}")
print(f" Response: {response}")
print("\n✅ Kimi K3 integration is working!")
except Exception as e:
print(f"\n❌ Error: {e}")
if __name__ == "__main__":
main()