feat: adding events and locations to json schema
This commit is contained in:
82
backend/ai_response.json
Normal file
82
backend/ai_response.json
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"name": "schema_description",
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"tags": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A list of tags you think the image is relevant to.",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A list of sentences the image contains.",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"links": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A list of all the links you can find in the image.",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"events": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A list of events you see on the image, mostly there usually only 1 or 0 events",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"coordinates": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A list of locations you see on the image, usually theres only 1 or 0 locations",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"coordinates": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["tags", "text", "links", "events", "locations"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"strict": true
|
||||||
|
}
|
@ -149,40 +149,86 @@ Use generic tags.
|
|||||||
|
|
||||||
const RESPONSE_FORMAT = `
|
const RESPONSE_FORMAT = `
|
||||||
{
|
{
|
||||||
"name": "schema_description",
|
"name": "schema_description",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"tags": {
|
"tags": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "A list of tags you think the image is relevant to.",
|
"description": "A list of tags you think the image is relevant to.",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"text": {
|
"text": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "A list of sentences the image contains.",
|
"description": "A list of sentences the image contains.",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "A list of all the links you can find in the image.",
|
"description": "A list of all the links you can find in the image.",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"events": {
|
||||||
"required": [
|
"type": "array",
|
||||||
"tags",
|
"description": "A list of events you see on the image, mostly there usually only 1 or 0 events",
|
||||||
"text",
|
"items": {
|
||||||
"links"
|
"type": "object",
|
||||||
],
|
"properties": {
|
||||||
"additionalProperties": false
|
"name": {
|
||||||
},
|
"type": "string"
|
||||||
"strict": true
|
},
|
||||||
|
"location": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"coordinates": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A list of locations you see on the image, usually theres only 1 or 0 locations",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"coordinates": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": ["string", "null"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["tags", "text", "links", "events", "locations"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"strict": true
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -319,5 +365,7 @@ func (client OpenAiClient) GetImageInfo(imageName string, imageData []byte) (Ima
|
|||||||
return ImageInfo{}, err
|
return ImageInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Println(string(response))
|
||||||
|
|
||||||
return parseOpenAiResponse(response)
|
return parseOpenAiResponse(response)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user