Skip to content

[Android] Session serialization uses base type instead of child for ConversationFunctionTool #310

Open
@maratoss

Description

@maratoss

Service

OpenAI

Describe the bug

Hi! Could you help me with the problem.

Smth wrong with serialization:
It sends request with wrong session's json
instead of using ConversationFunctionTool it uses base class ConversationTool
the session:
image

the serialized session:

{
	"session": {
		"instructions": "*hidden*",
		"voice": "alloy",
		"input_audio_format": "pcm16",
		"output_audio_format": "pcm16",
		"input_audio_transcription": {
			"model": "whisper-1"
		},
		"tools": [
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			},
			{
				"type": "function"
			}
		],
		"tool_choice": "auto"
	},
	"type": "session.update"
}

the following changes in ConversationSessionOptions.Serialization.cs fix the problem:
image

Steps to reproduce

  1. Need to create maui android project
  2. Create a session with Tools and Functions
  3. Configure the session
  4. it should send a corrected json

Code snippets

No response

OS

Android

.NET version

net8.0-android

Library version

2.1.0-beta.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategory: Something isn't working and appears to be a defect in the client library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions