found in a modified version of the Langsmith API : openapi.json
"FeedbackCreateCoreSchema": {
"properties": {
"feedback_source": {
"oneOf": [
{
"$ref": "#/components/schemas/AppFeedbackSource"
},
{
"$ref": "#/components/schemas/APIFeedbackSource"
},
{
"$ref": "#/components/schemas/ModelFeedbackSource"
},
{
"$ref": "#/components/schemas/AutoEvalFeedbackSource"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"api": "#/components/schemas/APIFeedbackSource",
"app": "#/components/schemas/AppFeedbackSource",
"auto_eval": "#/components/schemas/AutoEvalFeedbackSource",
"model": "#/components/schemas/ModelFeedbackSource"
}
},
"nullable": true
},
},
"type": "object",
"required": [
"key"
],
"title": "FeedbackCreateCoreSchema",
"description": "Schema used for creating feedback without run id or session id."
},
//...
"AppFeedbackSource": {
"properties": {
"type": {
"type": "string",
"title": "Type",
"default": "app",
"enum": [
"app"
]
},
"metadata": {
"additionalProperties": true,
"type": "object",
"nullable": true
}
},
"type": "object",
"title": "AppFeedbackSource",
"description": "Feedback from the LangChainPlus App."
},
This generates the following code:
// FromAppFeedbackSource overwrites any union data inside the FeedbackCreateCoreSchema_FeedbackSource as the provided AppFeedbackSource
func (t *FeedbackCreateCoreSchema_FeedbackSource) FromAppFeedbackSource(v AppFeedbackSource) error {
v.Type = "app"
b, err := json.Marshal(v)
t.union = b
return err
}
// AppFeedbackSource Feedback from the LangChainPlus App.
type AppFeedbackSource struct {
Metadata *map[string]interface{} `json:"metadata"`
Type *AppFeedbackSourceType `json:"type,omitempty"`
}
// AppFeedbackSourceType defines model for AppFeedbackSource.Type.
type AppFeedbackSourceType string
Notable, the type of Type in AppFeedbackSource is *string, so the assignment v.Type = "app" is an error.
Is there any workaround for this?
found in a modified version of the Langsmith API : openapi.json
This generates the following code:
Notable, the type of
TypeinAppFeedbackSourceis*string, so the assignmentv.Type = "app"is an error.Is there any workaround for this?