Skip to content
Merged
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
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Changelog

## 2.0.0

Brings the client in line with the public API (contract
`3e9c6fa0a27454d8d5300c42e4215c475c3954b085dae9901f429d0c531e50f3`, recorded in `PUBLIC_API_VERSION`).

### Added

- Customer memories: `listCustomerMemories`, `batchCreateCustomerMemoriesV2`, and the deprecated
`batchCreateCustomerMemories`.
- Files: `beginFileUpload`, `createFile`, `listFiles`.
- Knowledge bases: `listKnowledgeBases`, `createKnowledgeBase`, `readKnowledgeBase`, `updateKnowledgeBase`.
- Notes: `listNotes`, `readNote`.
- `readConversation(String)`, and `readConversationDeprecated` for the older `GET /conversations/{id}`.
- `readTool(String, Long)` to read a given tool version.
- Webhook events `conversation.start`, `back-office-task.complete`, `back-office-task.hand-off` and
`back-office-task.fail`. Unknown event types now return `WebhookType.UNKNOWN` with the raw JSON as data.
- Tools now carry their full definition: parameters, parameter sets, HTTP, webhook, async and MCP settings,
draft state and branch.
- New fields across conversations, messages, notes, articles, topics, hand-off targets, resource sources,
traffic groups, voice call context, back-office task attachments and webhook events.
- Enum values: `Channel.VOICE`, `ParticipantType.BOT`, `ProcedureStatus.UNSAVED` and `ARCHIVED`,
`Visibility.UNKNOWN`, `PublicationStatus.DELETED` and `EXCLUDED`, two Salesforce email identifier
types, and every support platform the API accepts.

### Fixed

- Requests now go to the configured base URL.
- Query parameters are sent and URL-encoded; path parameters are URL-encoded.
- `readConversation` calls `GET /conversations/{id}/read`.
- `listTools` and `listTerminologySubstitutions` read the API's wrapped list responses.
- `deleteHandOffTarget` sends the ID as a query parameter.
- Setting the daily limit returns the updated procedure.
- Resource fetches arrive as `action.execute` events.
- Topic reads accept an omitted support platform.
- Timestamps are sent as RFC 3339 strings, not numbers.
- `ParticipantType` sends the values the API accepts (`Customer`, `Agent`, `AI Agent`, `Bot`).
- Response fields and enum values the client does not know no longer fail parsing.
- Topics and procedure versions read the field names the API returns.
- `conversation.hand_off` webhooks parse again.
- Error responses to GET requests throw `ResponseException`, like other methods.
- Back-office task attachments send `base_64_contents`.

### Breaking changes

- Tool creation uses the returned ID. Omit the ID when building a create request.
- Read the public response fields on procedures, messages and back-office task attachments.
Procedure responses omit author details. Message responses omit the subject and conversation token.
Task attachments expose their download URL.
- Memory data, article and topic data, back-office task input and asynchronous tool results accept any JSON value.
- Use `SecretRefreshRequest` when configuring secret refreshes. The retry option sets the timeout per attempt.
- Use `ResourceSourceSchemaUpdate` to send a new raw schema for a resource source.
- File and note pagination expose the next cursor. Procedure pagination also exposes the previous cursor.

- `ParticipantType.HUMAN` is renamed `AGENT`.
- `AttachmentType.DOCUMENT`, `VIDEO` and `AUDIO` are removed; use `FILE`.
- Removed fields the API does not have: `Conversation.metadata`, `Message.metadata`,
`Message.conversationId`, `StartConversationRequest` and `AddMessageRequest` metadata, and
`ReadConversationRequest.includeMessages` (replaced by `supportPlatform`).
- `Tool`, `CreateToolRequest` and `UpdateToolRequest` follow the API's tool shape; `schema`, `created` and
`updated` are gone, and `UpdateToolRequest` no longer takes a name.
- `Topic.getData()` returns `byte[]`.
- `Memory` (v1 batch create) now requires `customType`, as the API does.
1 change: 0 additions & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ StartConversationRequest request = StartConversationRequest.builder()
.id("conversation-1234")
.customerId("user-1234")
.channel(Channel.CHAT)
.metadata(Map.of("source", "web"))
.build();

Conversation conv = client.startConversation(request);
Expand Down
1 change: 1 addition & 0 deletions PUBLIC_API_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3e9c6fa0a27454d8d5300c42e4215c475c3954b085dae9901f429d0c531e50f3
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ For Spring Boot applications, use the starter dependency for zero-configuration
<dependency>
<groupId>ai.gradient-labs</groupId>
<artifactId>gradient-labs-spring-boot-starter</artifactId>
<version>1.0.2</version>
<version>2.0.0</version>
</dependency>
```

### Gradle

```gradle
implementation 'ai.gradient-labs:gradient-labs-spring-boot-starter:1.0.2'
implementation 'ai.gradient-labs:gradient-labs-spring-boot-starter:2.0.0'
```

### Configuration
Expand Down Expand Up @@ -95,14 +95,14 @@ For non-Spring applications, use the core client library:
<dependency>
<groupId>ai.gradient-labs</groupId>
<artifactId>gradient-labs-client</artifactId>
<version>1.0.2</version>
<version>2.0.0</version>
</dependency>
```

### Gradle

```gradle
implementation 'ai.gradient-labs:gradient-labs-client:1.0.2'
implementation 'ai.gradient-labs:gradient-labs-client:2.0.0'
```

## Error Handling
Expand Down
13 changes: 2 additions & 11 deletions gradient-labs-client/examples/BasicConversationExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public static void main(String[] args) {
.id("conversation-" + System.currentTimeMillis())
.customerId("user-1234")
.channel(Channel.CHAT)
.addMetadata("source", "web")
.addMetadata("entrypoint", "home-page")
.addResource("user_profile", Map.of(
"name", "Jane Doe",
"email", "jane@example.com",
Expand All @@ -51,8 +49,6 @@ public static void main(String[] args) {
.participantId("user-1234")
.participantType(ParticipantType.CUSTOMER)
.created(Instant.now())
.addMetadata("device_os", "iOS 17")
.addMetadata("app_version", "2.1.0")
.addAttachment(new Attachment(
AttachmentType.IMAGE,
"order-receipt.jpg",
Expand All @@ -78,7 +74,7 @@ public static void main(String[] args) {
EventRequest eventRequest = EventRequest.builder()
.type("internal_note")
.participantId("system")
.participantType(ParticipantType.HUMAN)
.participantType(ParticipantType.AGENT)
.body("Customer has premium subscription - prioritize response")
.build();

Expand All @@ -91,12 +87,7 @@ public static void main(String[] args) {

// Read the conversation
System.out.println("\nReading conversation...");
Conversation updatedConv = client.readConversation(
conversation.getId(),
ReadConversationRequest.builder()
.includeMessages(true)
.build()
);
Conversation updatedConv = client.readConversation(conversation.getId());
System.out.println("✓ Conversation read");
System.out.println(" Status: " + updatedConv.getStatus());
System.out.println(" Agent active: " + updatedConv.isAgentActive());
Expand Down
1 change: 0 additions & 1 deletion gradient-labs-client/examples/ProceduresExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public static void main(String[] args) {
System.out.println("Name: " + proc.getName());
System.out.println("Description: " + proc.getDescription());
System.out.println("Status: " + proc.getStatus());
System.out.println("Author: " + (proc.getAuthor() != null ? proc.getAuthor().getEmail() : "N/A"));
System.out.println("Created: " + proc.getCreated());
System.out.println("Updated: " + proc.getUpdated());
System.out.println("Has Daily Limit: " + proc.isDailyLimited());
Expand Down
20 changes: 1 addition & 19 deletions gradient-labs-client/examples/WebhookHandlerExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
handleActionExecute(webhook.asActionExecute());
break;

case RESOURCE_PULL:
handleResourcePull(webhook.asResourcePull());
break;

default:
System.out.println("Unknown webhook type: " + webhook.getType());
}
Expand Down Expand Up @@ -146,23 +142,9 @@ private void handleActionExecute(ActionExecuteEvent event) {
// AddMessageRequest.builder()
// .id("action-result-" + System.currentTimeMillis())
// .body("Action result: " + result)
// .participantType(ParticipantType.HUMAN)
// .participantType(ParticipantType.AGENT)
// .build()
// );
}

private void handleResourcePull(ResourcePullEvent event) {
System.out.println("\n=== Resource Pull ===");
System.out.println("Conversation: " + event.getConversation().getId());
System.out.println("Resource Type: " + event.getResourceType());

// TODO: Fetch the requested resource and add it to the conversation
// Object resource = fetchResource(event.getResourceType());
//
// client.addConversationResource(
// event.getConversation().getId(),
// event.getResourceType(),
// resource
// );
}
}
2 changes: 1 addition & 1 deletion gradient-labs-client/examples/spring-boot-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<dependency>
<groupId>ai.gradient-labs</groupId>
<artifactId>gradient-labs-spring-boot-starter</artifactId>
<version>1.0.2</version>
<version>2.0.0</version>
</dependency>

<!-- Spring Boot Web -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ public ResponseEntity<Void> handleWebhook(HttpServletRequest request) {
// Execute the requested action
break;

case RESOURCE_PULL:
System.out.println("Resource pull event received");
// Fetch and return requested resource
break;

default:
System.out.println("Unknown webhook type: " + webhook.getType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public Conversation startConversation(String customerId) {
.id("conv-" + UUID.randomUUID())
.customerId(customerId)
.channel(Channel.CHAT)
.addMetadata("source", "spring-boot-example")
.build();

return client.startConversation(request);
Expand Down
2 changes: 1 addition & 1 deletion gradient-labs-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>ai.gradient-labs</groupId>
<artifactId>gradient-labs-parent</artifactId>
<version>1.0.2</version>
<version>2.0.0</version>
</parent>

<artifactId>gradient-labs-client</artifactId>
Expand Down
Loading
Loading