Skip to content

Commit

Permalink
Update Groq documentation and examples to use preferred patching meth…
Browse files Browse the repository at this point in the history
…od (#663)
  • Loading branch information
NasonZ committed May 16, 2024
1 parent d2648f5 commit cd5169e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/examples/groq.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ client = Groq(
api_key=os.environ.get('GROQ_API_KEY'),
)

client = instructor.from_groq(client, mode=instructor.Mode.JSON)
client = instructor.from_groq(client, mode=instructor.Mode.TOOLS)

resp = client.chat.completions.create(
model="mixtral-8x7b-32768",
Expand Down
4 changes: 2 additions & 2 deletions docs/hub/groq.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Instructor's patch enhances the openai api it with the following features:

## Groq AI

While Groq AI does not support function calling directly, you can still leverage the MD_JSON mode for structured outputs.
While Groq AI does not support function calling directly, you can still leverage the TOOLS mode for structured outputs.

!!! note "Getting access"

Expand All @@ -51,7 +51,7 @@ client = Groq(
)

# By default, the patch function will patch the ChatCompletion.create and ChatCompletion.create methods to support the response_model parameter
client = instructor.from_groq(client, mode=instructor.Mode.JSON)
client = instructor.from_groq(client, mode=instructor.Mode.TOOLS)


# Now, we can use the response_model parameter using only a base model
Expand Down
2 changes: 1 addition & 1 deletion examples/groq/groq_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Character(BaseModel):
api_key=os.environ.get("GROQ_API_KEY"),
)

client = instructor.from_groq(client, mode=instructor.Mode.JSON)
client = instructor.from_groq(client, mode=instructor.Mode.TOOLS)

resp = client.chat.completions.create(
model="mixtral-8x7b-32768",
Expand Down
2 changes: 1 addition & 1 deletion examples/groq/groq_example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
api_key=os.environ.get("GROQ_API_KEY"),
)

client = instructor.from_groq(client, mode=instructor.Mode.JSON)
client = instructor.from_groq(client, mode=instructor.Mode.TOOLS)


class UserExtract(BaseModel):
Expand Down

0 comments on commit cd5169e

Please sign in to comment.