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

.Net: Add Support for OpenAI new Structured Outputs. #7951

Closed
RogerBarreto opened this issue Aug 7, 2024 · 1 comment
Closed

.Net: Add Support for OpenAI new Structured Outputs. #7951

RogerBarreto opened this issue Aug 7, 2024 · 1 comment
Labels
ai connector Anything related to AI connectors .NET Issue or Pull requests regarding .NET code sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Comments

@RogerBarreto
Copy link
Member

Support for Structured Outputs

As mentioned in the recent blog post from OpenAI.

Now is possible to specify the response_format as json_schema:

This issue is a desired improvement which currently depends on the support being provided by the OpenAI .Net SDK.

Created issue in OpenAI SDK .Net to keep track.

POST /v1/chat/completions
{
  "model": "gpt-4o-2024-08-06",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful math tutor."
    },
    {
      "role": "user",
      "content": "solve 8x + 31 = 2"
    }
  ],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "math_response",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "explanation": {
                  "type": "string"
                },
                "output": {
                  "type": "string"
                }
              },
              "required": ["explanation", "output"],
              "additionalProperties": false
            }
          },
          "final_answer": {
            "type": "string"
          }
        },
        "required": ["steps", "final_answer"],
        "additionalProperties": false
      }
    }
  }
}
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Aug 7, 2024
@RogerBarreto RogerBarreto added ai connector Anything related to AI connectors sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) and removed triage labels Aug 7, 2024
@RogerBarreto
Copy link
Member Author

Closing this as this is a duplication of:

#7946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors .NET Issue or Pull requests regarding .NET code sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
Projects
Archived in project
Development

No branches or pull requests

2 participants