mirascope.core.groq.call¶
A decorator for calling the Groq API with a typed function.
Usage Documentation
This decorator is used to wrap a typed function that calls the Groq API. It parses the prompt template of the wrapped function as the messages array and templates the input arguments for the function into each message's template.
Example:
from mirascope.core import prompt_template
from mirascope.core.groq import groq_call
@groq_call("llama-3.1-8b-instant")
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
response = recommend_book("fantasy")
print(response.content)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
str
|
The Groq model to use in the API call. |
required |
stream |
bool
|
Whether to stream the response from the API call. |
required |
tools |
list[BaseTool | Callable]
|
The tools to use in the Groq API call. |
required |
response_model |
BaseModel | BaseType
|
The response model into which the response should be structured. |
required |
output_parser |
Callable[[CohereCallResponse | ResponseModelT], Any]
|
A function for parsing the call response whose value will be returned in place of the original call response. |
required |
json_mode |
bool
|
Whether to use JSON Mode. |
required |
client |
object
|
An optional custom client to use in place of the default client. |
required |
call_params |
GroqCallParams
|
The |
required |
Returns:
Name | Type | Description |
---|---|---|
decorator |
Callable
|
The decorator for turning a typed function into a Groq API call. |