Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureOpenAIGenerator not passing meta (used tokens, model...) to Langfuse #816

Closed
1 task done
LackesLab opened this issue Jun 3, 2024 · 2 comments · Fixed by #815
Closed
1 task done

AzureOpenAIGenerator not passing meta (used tokens, model...) to Langfuse #816

LackesLab opened this issue Jun 3, 2024 · 2 comments · Fixed by #815

Comments

@LackesLab
Copy link

Describe the bug
When intializing a pipeline including the LangFuse tracer and an AzureOpenAIGenerator, costs and tokens cannot be tracked properly like with the "original" OpenAIGenerator

Error message

Expected behavior
Below, you see 2 Screenshots. One is frome the pipeline using anOpenAIGenerator, the second one using the AzureOpenAIGenerator. Tokens and costs are not displayed as intended.

Additional context
openai_tracing

azure_tracing

Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.

To Reproduce

Initialization

I initialized all components. But for the current issues, only the generator is the problem, so i just packed the initialization into the sample code.

_generator = AzureOpenAIGenerator(
        azure_endpoint="https://<endpoint>.openai.azure.com",
        azure_deployment="<deployment_name>")



extractive_qa_pipeline = Pipeline()
#Add the tracer
extractive_qa_pipeline.add_component("tracer", LangfuseConnector("Basic RAG Pipeline"))

extractive_qa_pipeline.add_component(name="text_embedder", instance=text_embedder)
extractive_qa_pipeline.add_component(name="retriever", instance=retriever )
extractive_qa_pipeline.add_component(name="prompt_builder", instance=PromptBuilder(template=self.prompt_template))
extractive_qa_pipeline.add_component(name="generator", instance=_generator)

extractive_qa_pipeline.connect( sender="text_embedder.embedding", receiver="retriever.query_embedding")
extractive_qa_pipeline.connect( sender="retriever.documents", receiver="prompt_builder.documents")
extractive_qa_pipeline.connect(sender="prompt_builder", receiver="generator")

FAQ Check

System:

  • OS: MacOs
  • GPU/CPU: M2 Pro
  • Haystack version (commit or version number): 2.1
  • DocumentStore: Qdrant
  • Reader: -
  • Retriever: QdrantEmbeddingRetriever
@anakin87 anakin87 changed the title OpenAIGenerator not passing Mete Data like tokens and model name to LangFuse AzureOpenAIGenerator not passing meta (used tokens, model...) to Langfuse Jun 3, 2024
@anakin87
Copy link
Member

The problem probably lies in this part of the code. It seems that we are only considering OpenAI generators.

We need to investigate and see if we can generalize the behavior of the tracer.

@mrm1001 mrm1001 added the P2 label Jun 11, 2024
@shadeMe shadeMe added P1 and removed P2 labels Jun 14, 2024
@masci
Copy link
Contributor

masci commented Jun 14, 2024

@anakin87 is correct, we only support OpenAIGenerator. I would expect AzureOpenAIGenerator to be a drop-in replacement for OpenAIGenerator, in that case the fix would be easy.

@masci masci transferred this issue from deepset-ai/haystack Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants