You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Unauthorized Access When Integrating Traceloop SDK with LangSmith with LLama-index
Description
When attempting to integrate Traceloop SDK with LangSmith for tracing LlamaIndex operations, receiving consistent 401 Unauthorized errors. The trace export attempts are failing with the following error:
ERROR:
opentelemetry.exporter.otlp.proto.http.trace_exporter: Failed to export batch
code: 401,
reason: {"error":"Unauthorized"}
Current Setup
Using Traceloop SDK to send traces to LangSmith's OpenTelemetry endpoint
Environment configured with Azure OpenAI for LlamaIndex operations
# Initialize Traceloop SDK and LlamaIndex with Azure OpenAI# This script sets up tracing and testing of the LlamaIndex integration with Azure OpenAIimportosfromtraceloop.sdkimportTraceloop# Get LangSmith API key from environment variables for tracingLANGSMITH_API_KEY=os.getenv("LANGCHAIN_API_KEY")
# Initialize Traceloop with LangSmith endpoint and authentication# - api_endpoint: LangSmith OTEL endpoint for trace collection# - headers: Authentication and content type headers# - disable_batch: Send traces immediately without batching# - app_name: Name of the application for trace identificationTraceloop.init(api_endpoint="https://api.smith.langchain.com/otel",
headers=
{
"x-api-key": LANGSMITH_API_KEY,
"content-type": "application/protobuf"},
disable_batch=True,
app_name="test"
)
# Import required LlamaIndex componentsfromllama_index.coreimportVectorStoreIndex, Documentfromllama_index.llms.azure_openaiimportAzureOpenAIfromllama_index.embeddings.azure_openaiimportAzureOpenAIEmbeddingfromllama_index.coreimportSettingsfromapp.core.configimportget_settings# Load application settingssettings=get_settings()
# Define required Azure OpenAI settings to validate configurationrequired_settings= [
("Azure OpenAI API Key", settings.azure_openai_api_key),
("Azure OpenAI Endpoint", settings.azure_openai_endpoint),
("Azure OpenAI Deployment Name", settings.azure_openai_deployment_name),
("Azure OpenAI API Version", settings.azure_openai_api_version),
("Azure OpenAI Embeddings Name", settings.azure_openai_embeddings_name),
("Azure OpenAI Embeddings Endpoint", settings.azure_openai_embeddings_endpoint),
]
# Configure LlamaIndex to use Azure OpenAI for text generationSettings.llm=AzureOpenAI(
model=settings.text_model,
engine=settings.azure_openai_deployment_name,
deployment_name=settings.azure_openai_deployment_name,
api_key=settings.azure_openai_api_key,
azure_endpoint=settings.azure_openai_endpoint,
api_version=settings.azure_openai_api_version,
)
# Configure LlamaIndex to use Azure OpenAI for embeddingsSettings.embed_model=AzureOpenAIEmbedding(
model=settings.azure_openai_embeddings_model,
deployment_name=settings.azure_openai_embeddings_name,
api_key=settings.azure_openai_api_key,
azure_endpoint=settings.azure_openai_embeddings_endpoint,
api_version=settings.azure_openai_embeddings_api_version,
)
# Test the setup with a sample document and querytry:
# Create test index with example documentdocuments= [Document.example()]
index=VectorStoreIndex.from_documents(documents)
query_engine=index.as_query_engine()
# Run test queryresponse=query_engine.query("What is this document about?")
print(f"Query Response: {response}")
exceptExceptionase:
print(f"Error occurred: {str(e)}")
HTTP Request is working
The text was updated successfully, but these errors were encountered:
Issue: Unauthorized Access When Integrating Traceloop SDK with LangSmith with LLama-index
Description
When attempting to integrate Traceloop SDK with LangSmith for tracing LlamaIndex operations, receiving consistent 401 Unauthorized errors. The trace export attempts are failing with the following error:
Current Setup
Steps to Reproduce
Expected Behavior
Actual Behavior
Potential Investigation Done
LANGCHAIN_API_KEY
)Related Documentation
full implementation
HTTP Request is working
The text was updated successfully, but these errors were encountered: