Skip to content

Instantly share code, notes, and snippets.

@truevis
Last active April 20, 2024 07:24
Show Gist options
  • Select an option

  • Save truevis/7f4fa94d725030f77debce5bdbfa0299 to your computer and use it in GitHub Desktop.

Select an option

Save truevis/7f4fa94d725030f77debce5bdbfa0299 to your computer and use it in GitHub Desktop.
This script deftly enlists the Groq client to choreograph a dance with the llama3-70b-8192 model, playing out a skit where it conjures up an email about the thrilling world of government contract bidding in NY, sans the fluffy pleasantries.
from groq import Groq
# Initialize Groq client with API key
client = Groq(api_key="gsk_123")
completion = client.chat.completions.create(
model="llama3-70b-8192",
messages=[
{
"role": "system",
"content": "Wise Assistant"
},
{
"role": "user",
"content": "Context:\nCompose a draft email to my client about how to submit bids for government contracts in NY. Omit any initial greetings or pleasantries, such as 'I hope this message finds you well."
}
],
temperature=0.1,
max_tokens=8192,
top_p=1,
stream=True,
stop=None,
)
for chunk in completion:
print(chunk.choices[0].delta.content or "", end="")
@truevis
Copy link
Author

truevis commented Apr 20, 2024

This script deftly enlists the Groq client to choreograph a dance with the llama3-70b-8192 model, playing out a skit where it conjures up an email about the thrilling world of government contract bidding in NY, sans the fluffy pleasantries. Picture it as a digital concierge, coolly crafting a no-nonsense guide sans the "Hope this finds you well" snooze fest. The parameters set the stage for a low-drama, precise output, ensuring that the email stays as engaging as a tax form—and streams the fun in bite-sized chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment