instillapp

package
v0.29.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 15 Imported by: 0

README

---
title: "Instill App"
lang: "en-US"
draft: false
description: "Learn about how to set up a VDP Instill App component https://github.com/instill-ai/instill-core"
---

The Instill App component is an application component that allows users to manipulate Instill App related resources..
It can carry out the following tasks:
- [Read Chat History](#read-chat-history)
- [Write Chat Message](#write-chat-message)

## Release Stage

`Alpha`

## Configuration

The component definition and tasks are defined in the [definition.json](https://github.com/instill-ai/component/blob/main/application/instillapp/v0/config/definition.json) and [tasks.json](https://github.com/instill-ai/component/blob/main/application/instillapp/v0/config/tasks.json) files respectively.



## Supported Tasks

### Read Chat History

Retrieve the chat history from the conversation.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_READ_CHAT_HISTORY` |
| Namespace (required) | `namespace` | string | Fill in your namespace, you can get namespace through the tab of switching namespace. |
| App ID (required) | `app-id` | string | Fill in your app ID. |
| Conversation ID (required) | `conversation-id` | string | Fill in your conversation ID. |
| Role | `role` | string | The role of the user you want to specify to retrieve in the conversation. The default is all with the blank setting. Now, we support 'user' and 'assistant'. |
| Message Type | `message-type` | string | The message type of the chat history you want to retrieve. The default is all with blank setting. Now, we only support 'MESSAGE_TYPE_TEXT'. |
| Duration | `duration` | string | The duration between now and how long ago to retrieve the chat history from. i.e. 2h45m5s. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".  The default is all with blank setting. |
| Max Message Count | `max-message-count` | integer | The maximum number of messages to retrieve. The default is all with blank setting. |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| [Chat Messages](#read-chat-history-chat-messages) | `messages` | array[object] | List of chat messages |
</div>

<details>
<summary> Output Objects in Read Chat History</summary>

<h4 id="read-chat-history-chat-messages">Chat Messages</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| [Content](#read-chat-history-content) | `content` | array | The message content. |
| Name | `name` | string | An optional name for the participant. Provides the model information to differentiate between participants of the same role. |
| Role | `role` | string | The message role, i.e. 'system', 'user' or 'assistant'. |
</div>
</details>

### Write Chat Message

Write the chat message into the conversation in catalog.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_WRITE_CHAT_MESSAGE` |
| Namespace (required) | `namespace` | string | Fill in your namespace, you can get namespace through the tab of switching namespace. |
| App ID (required) | `app-id` | string | Fill in your app ID. |
| Conversation ID (required) | `conversation-id` | string | Fill in your conversation ID. |
| [Message](#write-chat-message-message) (required) | `message` | object | A chat message to be written into the conversation. |
</div>


<details>
<summary> Input Objects in Write Chat Message</summary>

<h4 id="write-chat-message-message">Message</h4>

A chat message to be written into the conversation.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| Content | `content` | string | The contents of the message.  |
| Role | `role` | string | The role of the author of this message. Now, we support 'user' and 'assistant'.  |
</div>
</details>



<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Message ID | `message-uid` | string | The unique identifier of the message. |
| Create Time | `create-time` | string | The creation time of the message in ISO 8601 format |
| Update Time | `update-time` | string | The update time of the message in ISO 8601 format |
</div>

Documentation

Index

Constants

View Source
const (
	TaskReadChatHistory  string = "TASK_READ_CHAT_HISTORY"
	TaskWriteChatMessage string = "TASK_WRITE_CHAT_MESSAGE"
)

Variables

This section is empty.

Functions

func Init

func Init(bc base.Component) *component

Types

type Connection

type Connection interface {
	Close() error
}

type Content

type Content struct {
	Type        string `json:"type"`
	Text        string `json:"text,omitempty"`
	ImageURL    string `json:"image-url,omitempty"`
	ImageBase64 string `json:"image-base64,omitempty"`
}

type Message

type Message struct {
	Content []Content `json:"content"`
	Role    string    `json:"role"`
	Name    string    `json:"name,omitempty"`
}

type ReadChatHistoryInput

type ReadChatHistoryInput struct {
	Namespace       string `json:"namespace"`
	AppUID          string `json:"app-id"`
	ConversationID  string `json:"conversation-id"`
	Role            string `json:"role"`
	MessageType     string `json:"message-type"`
	Duration        string `json:"duration"`
	MaxMessageCount int    `json:"max-message-count"`
}

func (*ReadChatHistoryInput) Validate

func (in *ReadChatHistoryInput) Validate() error

type ReadChatHistoryOutput

type ReadChatHistoryOutput struct {
	Messages []Message `json:"messages"`
}

func (*ReadChatHistoryOutput) Filter

func (out *ReadChatHistoryOutput) Filter(inputStruct ReadChatHistoryInput, messages []*appPB.Message)

type WriteChatMessageInput

type WriteChatMessageInput struct {
	Namespace      string       `json:"namespace"`
	AppUID         string       `json:"app-id"`
	ConversationID string       `json:"conversation-id"`
	Message        WriteMessage `json:"message"`
}

func (*WriteChatMessageInput) Validate

func (in *WriteChatMessageInput) Validate() error

type WriteChatMessageOutput

type WriteChatMessageOutput struct {
	MessageUID string `json:"message-uid"`
	CreateTime string `json:"create-time"`
	UpdateTime string `json:"update-time"`
}

type WriteMessage

type WriteMessage struct {
	Content string `json:"content"`
	Role    string `json:"role,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL