Output in notebook:
š To view the Phoenix app in your browser, visit http://localhost:6006/
š For more information on how to use Phoenix, check out https://docs.arize.com/phoenix
Phoenix app launched successfully.
LangChain successfully instrumented for Phoenix tracing.
Response: {
"id": "chatcmpl-9RZyao7pERZvZJi6ClvdzvvoctndQ",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "China is currently the world's second-largest economy after the United States, and is increasingly playing a significant and influential role in the global economy. It has experienced rapid economic growth since the 1970s due to a combination of domestic reforms and participation in the global market. China is the world's largest exporter of goods and has a vast industrial sector that goes beyond manufacturing, including technology, chemicals, and automotive. The country has a robust consumer market and holds a significant amount of global debt. Nevertheless, issues such as high levels of corporate debt, an aging population, and environmental challenges remain concerning for China's economic future. But with its Belt and Road Initiative, it is aggressively pursuing economic growth through increased global infrastructure investment and trade connectivity.",
"role": "assistant"
},
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"created": 1716360176,
"model": "gpt-4-32k",
"object": "chat.completion",
"system_fingerprint": null,
"usage": {
"completion_tokens": 147,
"prompt_tokens": 17,
"total_tokens": 164
},
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
]
}
Phoenix app view: http://localhost:6006/
Hello everybody, I am trying to run phoenix locally using a notebook. I am also able to integrate Langchain and our OpenAI Endpoint, run the web app, etc. But the problem is that I just cannot see the traces in the web app... I tried everything, can somebody tell me, what I am doing wrong? # Installation der Pakete #!pip install "langchain>=0.1.0" langchain-openai "openai>=1" "arize-phoenix[evals]" tiktoken nest-asyncio # Setze die Umgebungsvariablen import os os.environ["AZURE_OPENAI_ENDPOINT"] = "..." os.environ["AZURE_OPENAI_API_KEY"] = "..." os.environ["OPENAI_API_VERSION"] = "..." os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT_NAME"] = "..." os.environ["PHOENIX_PROJECT_NAME"] = "default" # Starten des Phoenix-Servers import phoenix as px import nest_asyncio nest_asyncio.apply() # needed for concurrent evals in notebook environments # Start Phoenix app try: session = px.launch_app() print("Phoenix app launched successfully.") except Exception as e: print(f"Failed to launch Phoenix app: {e}") # Instrumentieren von LangChain from phoenix.trace.langchain import LangChainInstrumentor # Instrument LangChain try: LangChainInstrumentor().instrument() print("LangChain successfully instrumented for Phoenix tracing.") except Exception as e: print(f"Failed to instrument LangChain: {e}") # Initialisieren deiner LangChain-Anwendung from openai import AzureOpenAI # Initialize Azure OpenAI model client = AzureOpenAI( azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"), api_version=os.getenv("OPENAI_API_VERSION") ) # Define the question question = "Give a brief summary of China's economic power." # Create the message for the model messages = [ { "role": "user", "content": question, } ] # Get the response from the LLM try: completion = client.chat.completions.create( model=os.getenv("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME"), messages=messages ) print("Response:", completion.to_json()) except Exception as e: print(f"Error: {e}") # Display the Phoenix dashboard in the notebook try: print(f"Phoenix app view: {px.active_session().url}") except AttributeError: print("No active Phoenix session found.")
