Skip to content
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

fix(conversation): prefix supporting types with AmplifyAI #907

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

atierian
Copy link
Member

@atierian atierian commented Nov 14, 2024

Related PRs

Problem

Conversation routes add several GraphQL types (type, input, enum, interface) to the GraphQL schema. These types are only added if a conversation route is defined via the @conversation directive and are conversation route agnostic (only added once per GraphQL schema regardless of the amount of conversation routes).

These types have generic enough names that they can conflict with customer defined types.

GraphQL Types
enum ConversationParticipantRole {
  user
  assistant
}

interface ConversationMessage {
  id: ID!
  conversationId: ID!
  associatedUserMessageId: ID
  role: ConversationParticipantRole
  content: [ContentBlock]
  aiContext: AWSJSON
  toolConfiguration: ToolConfiguration
  createdAt: AWSDateTime
  updatedAt: AWSDateTime
  owner: String
}

input DocumentBlockSourceInput {
  bytes: String
}

input DocumentBlockInput {
  format: String!
  name: String!
  source: DocumentBlockSourceInput!
}

input ImageBlockSourceInput {
  bytes: String
}

input ImageBlockInput {
  format: String!
  source: ImageBlockSourceInput!
}

input ToolUseBlockInput {
  toolUseId: String!
  name: String!
  input: AWSJSON!
}

input ToolResultContentBlockInput {
  document: DocumentBlockInput
  image: ImageBlockInput
  json: AWSJSON
  text: String
}

input ToolResultBlockInput {
  content: [ToolResultContentBlockInput!]!
  toolUseId: String!
  status: String
}

type DocumentBlockSource {
  bytes: String
}

type DocumentBlock {
  format: String!
  name: String!
  source: DocumentBlockSource!
}

type ImageBlock {
  format: String!
  source: ImageBlockSource!
}

type ImageBlockSource {
  bytes: String
}

type ToolUseBlock {
  toolUseId: String!
  name: String!
  input: AWSJSON!
}

type ToolResultContentBlock {
  document: DocumentBlock
  image: ImageBlock
  json: AWSJSON
  text: String
}

type ToolResultBlock {
  content: [ToolResultContentBlock!]!
  toolUseId: String!
  status: String
}

type ContentBlockText {
  text: String
}

type ContentBlockImage {
  image: ImageBlock
}

type ContentBlockDocument {
  document: DocumentBlock
}

type ContentBlockToolUse {
  toolUse: ToolUseBlock
}

type ContentBlockToolResult {
  toolResult: ToolResultBlock
}

input ContentBlockInput {
  text: String
  document: DocumentBlockInput
  image: ImageBlockInput
  toolResult: ToolResultBlockInput
  toolUse: ToolUseBlockInput
}

type ContentBlock {
  text: String
  document: DocumentBlock
  image: ImageBlock
  toolResult: ToolResultBlock
  toolUse: ToolUseBlock
}

input ToolConfigurationInput {
  tools: [ToolInput]
}

input ToolInput {
  toolSpec: ToolSpecificationInput
}

input ToolSpecificationInput {
  name: String!
  description: String
  inputSchema: ToolInputSchemaInput!
}

Description of changes

Prefixes all supporting types with "AmplifyAI".

The supporting types themselves are defined in data-schema (see related PR aws-amplify/amplify-data#395).

This PR updates appsync-modelgen-plugin as a consumer of these types. This is necessary to ensure the MIS is correct because the @models generated by the conversation transformer have fields using the supporting types.

Codegen Paramaters Changed or Added

N/A

Issue #, if available

See aws-amplify/amplify-ui#5773 (comment)

3b. I was already using Tool is my data model. It seems like any reserved words should be prefixed with a Namespace to prevent conflict.

Description of how you validated changes

Mix of manual and automated testing through tagged releases:

  • @aws-amplify/appsync-modelgen-plugin@2.15.1-ai-next.0
  • @aws-amplify/data-schema@0.0.0-ai-next-20241113232635
  • @aws-amplify/graphql-api-construct@1.17.2-ai-next.1

Checklist

  • PR description included
  • yarn test passes
  • E2E test run linked
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • Breaking changes to existing customers are released behind a feature flag or major version update
  • Changes are tested using sample applications for all relevant platforms (iOS/android/flutter/Javascript) that use the feature added/modified
  • Changes are tested on windows. Some Node functions (such as path) behave differently on windows.
  • Changes adhere to the GraphQL Spec and supports the GraphQL types type, input, enum, interface, union and scalar types.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@atierian atierian enabled auto-merge (squash) November 14, 2024 21:40
@atierian atierian merged commit eba466f into main Nov 14, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants