Replies: 1 comment 1 reply
-
That's interesting. Can you print the env when set via dotenv to confirm that it is correct? Langfuse just loads environment variables from os.getenv() if they are not provided in the constructor. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I have started to integrate Langfuse in my LLM app. I have a setup where i am Loading Docs from Qdrant Database and using LCEL to get response from OPENAI. Here is a brief code for it.
import os
from langchain import hub
from dotenv import load_dotenv
from langchain_community.vectorstores import Qdrant
from qdrant_client import QdrantClient
from qdrant_client.http import models
from qdrant_client import QdrantClient
from langchain_openai import OpenAIEmbeddings
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
from langchain_openai import ChatOpenAI
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough
from typing import Optional
from langfuse.callback import CallbackHandler
import traceback
Load environment variables from .env file
load_dotenv()
def util_bot(question: str) -> Optional[str]:
"""
Processes a given question using a combination of Qdrant vector search and an LLM (Large Language Model) response generation.
This function embeds the input question using OpenAI's embedding model, searches for relevant context using Qdrant,
and generates a response based on the context found and the input question using an LLM.
But this code is throwing an error:
File "d:\Util-bot-AzureContainerApp.venv\Lib\site-packages\langfuse\request.py", line 106, in _process_response
raise APIError(res.status_code, payload)
langfuse.request.APIError: {'error': 'UnauthorizedError', 'message': "Invalid public key. Confirm that you've configured the correct host."} (401): None
I have tried the basic debugging. My env variables are loading correctly. But the error persists with this approach.
However, Inputting the api and public key directly in the call back function runs the code correct.
Thanks in advance for any help
Beta Was this translation helpful? Give feedback.
All reactions