The SDK automatically handles streaming responses and captures the complete output:
stream = client.chat.completions.create( model="llama-3.1-70b-versatile", messages=[{"role": "user", "content": "Tell me a story"}], stream=True)for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")
const stream = await groq.chat.completions.create({ model: "llama-3.1-70b-versatile", messages: [{ role: "user", content: "Tell me a story" }], stream: true});for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content || "");}
Control which integrations are enabled using the instruments or blockInstruments configuration:
from netra import Netrafrom netra.instrumentation.instruments import InstrumentSet# Only enable Groq instrumentationNetra.init( headers=f"x-api-key={os.environ.get('NETRA_API_KEY')}", instruments={InstrumentSet.GROQ})# Or block specific instrumentationsNetra.init( headers=f"x-api-key={os.environ.get('NETRA_API_KEY')}", block_instruments={InstrumentSet.HTTPX})
import { Netra, NetraInstruments } from "netra-sdk";// Only enable Groq instrumentationawait Netra.init({ headers: `x-api-key=${process.env.NETRA_API_KEY}`, instruments: new Set([NetraInstruments.GROQ])});// Or block specific instrumentationsawait Netra.init({ headers: `x-api-key=${process.env.NETRA_API_KEY}`, blockInstruments: new Set([NetraInstruments.HTTP])});