/ examples / groq / tracing.py
tracing.py
 1  """
 2  This is an example for leveraging MLflow's auto tracing capabilities for Groq.
 3  
 4  For more information about MLflow Tracing, see: https://mlflow.org/docs/latest/llms/tracing/index.html
 5  """
 6  
 7  import groq
 8  
 9  import mlflow
10  
11  # Turn on auto tracing for Groq by calling mlflow.groq.autolog()
12  mlflow.groq.autolog()
13  
14  client = groq.Groq()
15  
16  # Use the create method to create new message
17  message = client.chat.completions.create(
18      model="llama3-8b-8192",
19      messages=[
20          {
21              "role": "user",
22              "content": "Explain the importance of low latency LLMs.",
23          }
24      ],
25  )
26  
27  print(message.choices[0].message.content)