from dotenv import load_dotenv | |
from langchain_openai import ChatOpenAI | |
# Load environment variables from .env file | |
load_dotenv() | |
def test_langsmith_integration(): | |
try: | |
# Initialize the ChatOpenAI model | |
llm = ChatOpenAI() | |
# Test the model with a simple prompt | |
response = llm.invoke("Hello, world!") | |
print("LangSmith Integration Test:") | |
print("-" * 50) | |
print("Response:", response) | |
print("\nLangSmith tracing is enabled. You can view the traces at:") | |
print("https://smith.langchain.com/") | |
except Exception as e: | |
print(f"An error occurred: {str(e)}") | |
if __name__ == "__main__": | |
test_langsmith_integration() | |