跳到主要内容

跟踪 Groq

Groq tracing via autolog

MLflow 跟踪在使用 Groq 时提供自动跟踪功能。通过调用 mlflow.groq.autolog() 函数启用 Groq 自动跟踪后,在使用 Groq SDK 进行交互式开发时,会自动记录生成的跟踪信息。

请注意,仅支持同步调用,异步 API 和流式方法不受跟踪。

使用示例

import groq

import mlflow

# Turn on auto tracing for Groq by calling mlflow.groq.autolog()
mlflow.groq.autolog()

client = groq.Groq()

# Use the create method to create new message
message = client.chat.completions.create(
model="llama3-8b-8192",
messages=[
{
"role": "user",
"content": "Explain the importance of low latency LLMs.",
}
],
)

print(message.choices[0].message.content)

禁用自动跟踪

可以通过调用 mlflow.groq.autolog(disable=True)mlflow.autolog(disable=True) 全局禁用 Groq 的自动跟踪。