client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client

Copyright © 2024 Harmony AI Solutions & Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package client

Copyright © 2024 Harmony AI Solutions & Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioInferenceRequest

type AudioInferenceRequest struct {
	AIID      string `json:"ai_id"`
	MessageID string `json:"messageID"`
}

AudioInferenceRequest represents the request body for the Audio Inference API.

type ChatMessage

type ChatMessage struct {
	ID        string `firestore:"-"` // Firestore document ID, not a field in the document itself
	Message   string `firestore:"message"`
	Sender    string `firestore:"sender"`
	Timestamp int64  `firestore:"timestamp"` // Firestore stores this as a Unix timestamp (integer)
	Audio     string `firestore:"audio"`     // This is encoded and contains the details to fetch the audio data
}

ChatMessage represents a single message in the chat history.

func (*ChatMessage) GetTime

func (cm *ChatMessage) GetTime() time.Time

GetTime returns the timestamp as a time.Time object.

type KindroidAI

type KindroidAI struct {
	APIKey     string
	KindroidID string
	BaseURL    string
	Client     *http.Client
	UserID     string
	JWTAuth    bool
}

KindroidAI stores session parameters for interacting with the KindroidAI API.

func NewKindroidAI

func NewKindroidAI(apiKey, kindroidID string) *KindroidAI

NewKindroidAI initializes a new KindroidAI client. It will attempt to extract the UserID from the apiKey if it's a JWT. If not, it will fall back to the KINDROID_USER_ID environment variable.

func (*KindroidAI) AudioInference

func (k *KindroidAI) AudioInference(messageID string) ([]byte, error)

AudioInference sends an audio inference request to the AI.

WARNING: This method uses an undocumented API endpoint discovered through network analysis. It may change or be removed without notice. Use at your own risk in production environments.

func (*KindroidAI) ChatBreak

func (k *KindroidAI) ChatBreak(greeting string) error

ChatBreak ends the current chat session and starts a new one with a customizable greeting sent by the AI.

func (*KindroidAI) CheckUserSubscription

func (k *KindroidAI) CheckUserSubscription() (*SubscriptionInfo, error)

CheckUserSubscription retrieves user subscription information.

WARNING: This method uses an undocumented API endpoint discovered through network analysis. It may change or be removed without notice. Use at your own risk in production environments.

func (*KindroidAI) GetChatHistory

func (k *KindroidAI) GetChatHistory(ctx context.Context, aiID string, limit int) ([]*ChatMessage, error)

GetChatHistory retrieves the most recent chat messages for a given AI from Firestore.

func (*KindroidAI) GetMessageById

func (k *KindroidAI) GetMessageById(ctx context.Context, aiID string, messageID string) (*ChatMessage, error)

func (*KindroidAI) SendMessage

func (k *KindroidAI) SendMessage(message string) (string, error)

SendMessage sends a message to the AI and returns the response. This is the basic version for backwards compatibility.

func (*KindroidAI) SendMessageAdvanced

func (k *KindroidAI) SendMessageAdvanced(options SendMessageOptions) (string, error)

SendMessageAdvanced sends a message to the AI with advanced options and returns the response. This method supports multimedia, streaming, and other advanced features.

func (*KindroidAI) SetupUserAndPermissions

func (k *KindroidAI) SetupUserAndPermissions() error

type SendMessageOptions

type SendMessageOptions struct {
	AIID             string   `json:"ai_id"`
	Message          string   `json:"message"`
	Stream           bool     `json:"stream"`
	ImageURLs        []string `json:"image_urls,omitempty"`
	ImageDescription *string  `json:"image_description,omitempty"`
	VideoURL         *string  `json:"video_url,omitempty"`
	VideoDescription *string  `json:"video_description,omitempty"`
	InternetResponse *string  `json:"internet_response,omitempty"`
	LinkURL          *string  `json:"link_url,omitempty"`
	LinkDescription  *string  `json:"link_description,omitempty"`
}

SendMessageOptions represents the request body for the enhanced SendMessage API.

type SubscriptionInfo

type SubscriptionInfo struct {
	UID                        string  `json:"uid"`
	Status                     string  `json:"status"`
	IsSubscribedBase           bool    `json:"isSubscribedBase"`
	SubscriptionPlatformBase   string  `json:"subscriptionPlatformBase"`
	GracePeriodBase            *int    `json:"gracePeriodBase"` // Use pointer for nullable int
	IsSubscribedAddon1         bool    `json:"isSubscribedAddon1"`
	SubscriptionPlatformAddon1 *string `json:"subscriptionPlatformAddon1"` // Use pointer for nullable string
	GracePeriodAddon1          *int    `json:"gracePeriodAddon1"`
	IsSubscribedAddon2         bool    `json:"isSubscribedAddon2"`
	SubscriptionPlatformAddon2 *string `json:"subscriptionPlatformAddon2"`
	GracePeriodAddon2          *int    `json:"gracePeriodAddon2"`
}

SubscriptionInfo represents the response structure for user subscription details.

Jump to

Keyboard shortcuts

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