File size: 726 Bytes
f1e6b80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()