Skip to content

Commit

Permalink
This change is to deprecate the existing citation field under Retriev…
Browse files Browse the repository at this point in the history
…eAndGenerateStream API response in lieu of GeneratedResponsePart and RetrievedReferences
  • Loading branch information
aws-sdk-dotnet-automation committed Jan 31, 2025
1 parent 14e55b0 commit 21d6320
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,13 @@
"CitationEvent":{
"type":"structure",
"members":{
"citation":{"shape":"Citation"}
"citation":{
"shape":"Citation",
"deprecated":true,
"deprecatedMessage":"Citation is deprecated. Please use GeneratedResponsePart and RetrievedReferences for citation event."
},
"generatedResponsePart":{"shape":"GeneratedResponsePart"},
"retrievedReferences":{"shape":"RetrievedReferences"}
},
"event":true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,8 @@
"GeneratedResponsePart": {
"base": "<p>Contains metadata about a part of the generated response that is accompanied by a citation.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax\">InvokeAgent response</a> – in the <code>generatedResponsePart</code> field</p> </li> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax\">RetrieveAndGenerate response</a> – in the <code>generatedResponsePart</code> field</p> </li> </ul>",
"refs": {
"Citation$generatedResponsePart": "<p>Contains the generated response and metadata </p>"
"Citation$generatedResponsePart": "<p>Contains the generated response and metadata </p>",
"CitationEvent$generatedResponsePart": "<p>The generated response to the citation event.</p>"
}
},
"GenerationConfiguration": {
Expand Down Expand Up @@ -2387,6 +2388,7 @@
"base": null,
"refs": {
"Citation$retrievedReferences": "<p>Contains metadata about the sources cited for the generated response.</p>",
"CitationEvent$retrievedReferences": "<p>The retrieved references of the citation event.</p>",
"KnowledgeBaseLookupOutput$retrievedReferences": "<p>Contains metadata about the sources cited for the generated response.</p>"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,17 @@
"members":{
"citation":{
"shape":"Citation",
"documentation":"<p>The citation.</p>"
"documentation":"<p>The citation.</p>",
"deprecated":true,
"deprecatedMessage":"Citation is deprecated. Please use GeneratedResponsePart and RetrievedReferences for citation event."
},
"generatedResponsePart":{
"shape":"GeneratedResponsePart",
"documentation":"<p>The generated response to the citation event.</p>"
},
"retrievedReferences":{
"shape":"RetrievedReferences",
"documentation":"<p>The retrieved references of the citation event.</p>"
}
},
"documentation":"<p>A citation event.</p>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ public partial class CitationEvent
: IEventStreamEvent
{
private Citation _citation;
private GeneratedResponsePart _generatedResponsePart;
private List<RetrievedReference> _retrievedReferences = AWSConfigs.InitializeCollections ? new List<RetrievedReference>() : null;

/// <summary>
/// Gets and sets the property Citation.
/// <para>
/// The citation.
/// </para>
/// </summary>
[Obsolete("Citation is deprecated. Please use GeneratedResponsePart and RetrievedReferences for citation event.")]
public Citation Citation
{
get { return this._citation; }
Expand All @@ -59,5 +62,41 @@ internal bool IsSetCitation()
return this._citation != null;
}

/// <summary>
/// Gets and sets the property GeneratedResponsePart.
/// <para>
/// The generated response to the citation event.
/// </para>
/// </summary>
public GeneratedResponsePart GeneratedResponsePart
{
get { return this._generatedResponsePart; }
set { this._generatedResponsePart = value; }
}

// Check to see if GeneratedResponsePart property is set
internal bool IsSetGeneratedResponsePart()
{
return this._generatedResponsePart != null;
}

/// <summary>
/// Gets and sets the property RetrievedReferences.
/// <para>
/// The retrieved references of the citation event.
/// </para>
/// </summary>
public List<RetrievedReference> RetrievedReferences
{
get { return this._retrievedReferences; }
set { this._retrievedReferences = value; }
}

// Check to see if RetrievedReferences property is set
internal bool IsSetRetrievedReferences()
{
return this._retrievedReferences != null && (this._retrievedReferences.Count > 0 || !AWSConfigs.InitializeCollections);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ public CitationEvent Unmarshall(JsonUnmarshallerContext context)
unmarshalledObject.Citation = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("generatedResponsePart", targetDepth))
{
var unmarshaller = GeneratedResponsePartUnmarshaller.Instance;
unmarshalledObject.GeneratedResponsePart = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("retrievedReferences", targetDepth))
{
var unmarshaller = new ListUnmarshaller<RetrievedReference, RetrievedReferenceUnmarshaller>(RetrievedReferenceUnmarshaller.Instance);
unmarshalledObject.RetrievedReferences = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
Expand Down

0 comments on commit 21d6320

Please sign in to comment.