Skip to content

Invalid definition of conversation_history #113

@izogfif

Description

@izogfif

https://raw.githubusercontent.com/typesense/typesense-api-spec/master/openapi.yml has this definition:

    SearchResultConversation:
      type: object
      required:
        - answer
        - conversation_history
        - conversation_id
        - query
      properties:
        answer:
          type: string
        conversation_history:
          type: array
          items:
            type: object
        conversation_id:
          type: string
        query:
          type: string

while the server (at least the one running inside Docker image typesense/typesense:30.1) to a POST request made to
/multi_search?conversation=true&conversation_model_id=some_id&q=some%20question endpoint returns this response:

{
	"conversation": {
		"answer": "Some answer",
		"conversation_history": {
			"conversation": [{
				"user": "some question"
			}, {
				"assistant": "some text"
			}],
			"last_updated": 1771040240
		},
		"conversation_id": "103244f3-2f0d-4bfa-acd8-62c881170018",
		"query": "some query"
	},
	"results": []
}

The issue is that conversation_history in openapi.yml is an array while in server's response it is an object. As the result, typesense-java library is built with wrong classes and I get a runtime error during deserialization of server's response:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList<java.lang.Object>` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 787] (through reference chain: org.typesense.model.MultiSearchResult["conversation"]->org.typesense.model.SearchResultConversation["conversation_history"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions