Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.16.0 breaks response_format #4

Open
arthurbrenno opened this issue Jan 10, 2025 · 0 comments
Open

1.16.0 breaks response_format #4

arthurbrenno opened this issue Jan 10, 2025 · 0 comments

Comments

@arthurbrenno
Copy link

arthurbrenno commented Jan 10, 2025

I'm using the latest version of the cerebras-cloud-sdk. Using the new "ResponseFormatResponseFormatJsonSchemaJsonSchemaTyped", it gives me the following error:

BadRequestError: Error code: 400 - {'message': 'Unsupported "response_format" type: "json_schema"', 'type': 'invalid_request_error', 'param': 'response_format', 'code': 
'wrong_api_format'}

relevant part of my code:

await client.chat.completions.create(
                messages=[message.to_cerebras_format() for message in messages],
                model=self.model_name,
                max_completion_tokens=max_completion_tokens,
                n=n,
                stop=list(stop_sequences) if stop_sequences else None,
                response_format=ResponseFormatResponseFormatJsonSchemaTyped(
                    json_schema=ResponseFormatResponseFormatJsonSchemaJsonSchemaTyped(
                        name=response_model.__name__,
                        description="Structured Response",
                        schema=flatten_msgspec_schema(
                            msgspec.json.schema(response_model), openai_like=True
                        ),
                        strict=True,
                    ),
                    type="json_schema",
                )
                if response_model
                else None,
                temperature=temperature,
                tools=[
                    ToolTyped(
                        function=Function.from_callable(tool).to_cerebras_function(),
                        type="tool",
                    )
                    for tool in tools
                ]
                if tools
                else None,
                parallel_tool_calls=True,
            ),
        )

Am I doing something wrong? I see that I have no docs to look in. So I'm kinda going by my own and see where I can get.

@arthurbrenno arthurbrenno changed the title 1.16.0 breaks response 1.16.0 breaks response_format Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant