Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 62 additions & 48 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@

from groq import Groq, AsyncGroq, APIResponseValidationError
from groq._types import Omit
from groq._utils import maybe_transform
from groq._models import BaseModel, FinalRequestOptions
from groq._constants import RAW_RESPONSE_HEADER
from groq._exceptions import GroqError, APIStatusError, APITimeoutError, APIResponseValidationError
from groq._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, make_request_options
from groq.types.chat.completion_create_params import CompletionCreateParams

from .utils import update_env

Expand Down Expand Up @@ -706,18 +708,21 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
"/openai/v1/chat/completions",
body=cast(
object,
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
maybe_transform(
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
),
CompletionCreateParams,
),
),
cast_to=httpx.Response,
Expand All @@ -736,18 +741,21 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
"/openai/v1/chat/completions",
body=cast(
object,
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
maybe_transform(
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
),
CompletionCreateParams,
),
),
cast_to=httpx.Response,
Expand Down Expand Up @@ -1526,18 +1534,21 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
"/openai/v1/chat/completions",
body=cast(
object,
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
maybe_transform(
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
),
CompletionCreateParams,
),
),
cast_to=httpx.Response,
Expand All @@ -1556,18 +1567,21 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
"/openai/v1/chat/completions",
body=cast(
object,
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
maybe_transform(
dict(
messages=[
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
},
],
model="llama3-8b-8192",
),
CompletionCreateParams,
),
),
cast_to=httpx.Response,
Expand Down