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
In my trace dashboard, I am seeing a trace name show up as "Unknown", however, if I try to filter by "Unknown" on the individual trace page "Unknown" is not an option. Wondering why this is. Also, would be nice to be able to click on the number in the dashboard and it automatically apply the "name" filter so that I can dig in quicker and easily understand how that number came to be.
To reproduce
from langchain_openai import AzureChatOpenAI
from langfuse.callback import CallbackHandler
from langchain.prompts import PromptTemplate
from langchain.prompts.chat import (
ChatPromptTemplate,
SystemMessagePromptTemplate,
AIMessagePromptTemplate,
HumanMessagePromptTemplate,
)
llm = AzureChatOpenAI(
azure_endpoint=os.environ.get("AZURE_OPENAI_API_BASE"),
azure_deployment="gpt35-turbo",
openai_api_version="2023-03-15-preview",
openai_api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
)
class OpenAIRequest(BaseModel):
system_message: str = "You are a helpful assistant"
query: str
temperature: float = 0
model_name: CHAT_MODELS = CHAT_MODELS.gpt35_turbo
output_parser: Optional[Literal["list", "object"]] = None
object_schema: Optional[dict] = (
None # Example of how to setup pydantic model (MUST NAME CLASS OutputClassGPT): https://python.langchain.com/docs/modules/model_io/output_parsers/pydantic
)
source: str
user: str = None
project_name: str = None # will be used for tracing in langfuse
metadata: Optional[dict] = None
version: Optional[str] = None
@llm_app.post("/generate/chat")
def generate_chat(request: OpenAIRequest):
system_message_prompt = SystemMessagePromptTemplate.from_template(
"you are a helpful assistant"
)
prompt = PromptTemplate(
template=request.prompt,
input_variables=[],
)
human_message_prompt = HumanMessagePromptTemplate(prompt=prompt)
chat_prompt = ChatPromptTemplate.from_messages(
[system_message_prompt, human_message_prompt]
)
formatted_prompt = chat_prompt.format_prompt().to_messages()
trace = langfuse.trace(
name=request.project_name,
user_id=request.user,
tags=[request.source],
metadata=request.metadata if request.metadata else {},
version=request.version if request.version else "1",
input=formatted_prompt,
)
langfuse_handler = trace.get_langchain_handler()
resp = chatgpt.invoke(formatted_prompt, config={"callbacks": [langfuse_handler]})
result = resp.content
trace.update(output=result)
Additional information
No response
The text was updated successfully, but these errors were encountered:
I think it makes sense to make this more clear, is [no-trace-name] or null more intuitive than Unknown?
Being able to filter for trace.name=null is a great feature request, I'll update this issue accordingly.
marcklingen
changed the title
bug: "Unknown" Trace name in Dashboard but not present as trace name filter
feat(ui): allow filtering for null values (trace.name)
Feb 21, 2024
Describe the bug
In my trace dashboard, I am seeing a trace name show up as "Unknown", however, if I try to filter by "Unknown" on the individual trace page "Unknown" is not an option. Wondering why this is. Also, would be nice to be able to click on the number in the dashboard and it automatically apply the "name" filter so that I can dig in quicker and easily understand how that number came to be.
To reproduce
Additional information
No response
The text was updated successfully, but these errors were encountered: