Skip to content

feat(chat): support annotations field in ChatMessage.kt #439

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.aallam.openai.api.chat

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
public data class Annotations(
/**
* Type of annotation. e.g. `url_citation`
*/
val type: String,

/**
* An annotation object will contain the URL and title of the cited source,
* as well as the start and end index characters in the model's response where those sources were used.
*/
@SerialName("url_citation")
val urlCitation: UrlCitation? = null
)

@Serializable
public data class UrlCitation(
/**
* Start index of characters in the model's response
*/
@SerialName("start_index")
val startIndex: Int,
/**
* End index of characters in the model's response
*/
@SerialName("end_index")
val endIndex: Int,
/**
* URL of the cited source
*/
val url: String,
/**
* Page title of the cited source
*/
val title: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public data class ChatMessage(
* Azure Content Filter Offsets
*/
@SerialName("content_filter_offsets") public val contentFilterOffsets: List<ContentFilterOffsets>? = null,

/**
* Response metadata. May be used for web search `url_citation`, for example
*/
@SerialName("annotations") public val annotations: List<Annotations>? = null
) {

public constructor(
Expand Down