Skip to main content

telnyx-ai-assistants-java

Create and manage AI voice assistants with custom personalities, knowledge bases, and tool integrations. This skill provides Java SDK examples.

来源信息

仓库
team-telnyx/telnyx-toolkit
最近来源活动
2026年2月10日 20:41
检测到的 SKILL.md 语言
英语
星标
3
分支
2

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
telnyx-ai-assistants-java
description
Create and manage AI voice assistants with custom personalities, knowledge bases, and tool integrations. This skill provides Java SDK examples.
metadata
{"author":"telnyx","product":"ai-assistants","language":"java","generated_by":"telnyx-ext-skills-generator"}
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. --> # Telnyx Ai Assistants - Java ## Installation ```text // See https://github.com/team-telnyx/telnyx-java for Maven/Gradle setup ``` ## Setup ```java import com.telnyx.sdk.client.TelnyxClient; import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient; TelnyxClient client = TelnyxOkHttpClient.fromEnv(); ``` All examples below assume `client` is already initialized as shown above. ## List assistants Retrieve a list of all AI Assistants configured by the user. `GET /ai/assistants` ```java import com.telnyx.sdk.models.ai.assistants.AssistantListParams; import com.telnyx.sdk.models.ai.assistants.AssistantsList; AssistantsList assistantsList = client.ai().assistants().list(); ``` ## Create an assistant Create a new AI Assistant. `POST /ai/assistants` — Required: `name`, `model`, `instructions` ```java import com.telnyx.sdk.models.ai.assistants.AssistantCreateParams; import com.telnyx.sdk.models.ai.assistants.InferenceEmbedding; AssistantCreateParams params = AssistantCreateParams.builder() .instructions("instructions") .model("model") .name("name") .build(); InferenceEmbedding assistant = client.ai().assistants().create(params); ``` ## Get an assistant Retrieve an AI Assistant configuration by `assistant_id`. `GET /ai/assistants/{assistant_id}` ```java import com.telnyx.sdk.models.ai.assistants.AssistantRetrieveParams; import com.telnyx.sdk.models.ai.assistants.InferenceEmbedding; InferenceEmbedding assistant = client.ai().assistants().retrieve("assistant_id"); ``` ## Update an assistant Update an AI Assistant's attributes. `POST /ai/assistants/{assistant_id}` ```java import com.telnyx.sdk.models.ai.assistants.AssistantUpdateParams; import com.telnyx.sdk.models.ai.assistants.InferenceEmbedding; InferenceEmbedding assistant = client.ai().assistants().update("assistant_id"); ``` ## Delete an assistant Delete an AI Assistant by `assistant_id`. `DELETE /ai/assistants/{assistant_id}` ```java import com.telnyx.sdk.models.ai.assistants.AssistantDeleteParams; import com.telnyx.sdk.models.ai.assistants.AssistantDeleteResponse; AssistantDeleteResponse assistant = client.ai().assistants().delete("assistant_id"); ``` ## Assistant Chat (BETA) This endpoint allows a client to send a chat message to a specific AI Assistant. `POST /ai/assistants/{assistant_id}/chat` — Required: `content`, `conversation_id` ```java import com.telnyx.sdk.models.ai.assistants.AssistantChatParams; import com.telnyx.sdk.models.ai.assistants.AssistantChatResponse; AssistantChatParams params = AssistantChatParams.builder() .assistantId("assistant_id") .content("Tell me a joke about cats") .conversationId("42b20469-1215-4a9a-8964-c36f66b406f4") .build(); AssistantChatResponse response = client.ai().assistants().chat(params); ``` ## Assistant Sms Chat Send an SMS message for an assistant. `POST /ai/assistants/{assistant_id}/chat/sms` — Required: `from`, `to` ```java import com.telnyx.sdk.models.ai.assistants.AssistantSendSmsParams; import com.telnyx.sdk.models.ai.assistants.AssistantSendSmsResponse; AssistantSendSmsParams params = AssistantSendSmsParams.builder() .assistantId("assistant_id") .from("from") .to("to") .build(); AssistantSendSmsResponse response = client.ai().assistants().sendSms(params); ``` ## Clone Assistant Clone an existing assistant, excluding telephony and messaging settings. `POST /ai/assistants/{assistant_id}/clone` ```java import com.telnyx.sdk.models.ai.assistants.AssistantCloneParams; import com.telnyx.sdk.models.ai.assistants.InferenceEmbedding; InferenceEmbedding assistant = client.ai().assistants().clone("assistant_id"); ``` ## Import assistants from external provider Import assistants from external providers. `POST /ai/assistants/import` — Required: `provider`, `api_key_ref` ```java import com.telnyx.sdk.models.ai.assistants.AssistantImportsParams; import com.telnyx.sdk.models.ai.assistants.AssistantsList; AssistantImportsParams params = AssistantImportsParams.builder() .apiKeyRef("api_key_ref") .provider(AssistantImportsParams.Provider.ELEVENLABS) .build(); AssistantsList assistantsList = client.ai().assistants().imports(params); ``` ## List scheduled events Get scheduled events for an assistant with pagination and filtering `GET /ai/assistants/{assistant_id}/scheduled_events` ```java import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventListPage; import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventListParams; ScheduledEventListPage page = client.ai().assistants().scheduledEvents().list("assistant_id"); ``` ## Create a scheduled event Create a scheduled event for an assistant `POST /ai/assistants/{assistant_id}/scheduled_events` — Required: `telnyx_conversation_channel`, `telnyx_end_user_target`, `telnyx_agent_target`, `scheduled_at_fixed_datetime` ```java import com.telnyx.sdk.models.ai.assistants.scheduledevents.ConversationChannelType; import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventCreateParams; import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventResponse; import java.time.OffsetDateTime; ScheduledEventCreateParams params = ScheduledEventCreateParams.builder() .assistantId("assistant_id") .scheduledAtFixedDatetime(OffsetDateTime.parse("2025-04-15T13:07:28.764Z")) .telnyxAgentTarget("telnyx_agent_target") .telnyxConversationChannel(ConversationChannelType.PHONE_CALL) .telnyxEndUserTarget("telnyx_end_user_target") .build(); ScheduledEventResponse scheduledEventResponse = client.ai().assistants().scheduledEvents().create(params); ``` ## Get a scheduled event Retrieve a scheduled event by event ID `GET /ai/assistants/{assistant_id}/scheduled_events/{event_id}` ```java import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventResponse; import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventRetrieveParams; ScheduledEventRetrieveParams params = ScheduledEventRetrieveParams.builder() .assistantId("assistant_id") .eventId("event_id") .build(); ScheduledEventResponse scheduledEventResponse = client.ai().assistants().scheduledEvents().retrieve(params); ``` ## Delete a scheduled event If the event is pending, this will cancel the event. `DELETE /ai/assistants/{assistant_id}/scheduled_events/{event_id}` ```java import com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventDeleteParams; ScheduledEventDeleteParams params = ScheduledEventDeleteParams.builder() .assistantId("assistant_id") .eventId("event_id") .build(); client.ai().assistants().scheduledEvents().delete(params); ``` ## List assistant tests with pagination Retrieves a paginated list of assistant tests with optional filtering capabilities `GET /ai/assistants/tests` ```java import com.telnyx.sdk.models.ai.assistants.tests.TestListPage; import com.telnyx.sdk.models.ai.assistants.tests.TestListParams; TestListPage page = client.ai().assistants().tests().list(); ``` ## Create a new assistant test Creates a comprehensive test configuration for evaluating AI assistant performance `POST /ai/assistants/tests` — Required: `name`, `destination`, `instructions`, `rubric` ```java import com.telnyx.sdk.models.ai.assistants.tests.AssistantTest; import com.telnyx.sdk.models.ai.assistants.tests.TestCreateParams; TestCreateParams params = TestCreateParams.builder() .destination("+15551234567") .instructions("Act as a frustrated customer who received a damaged product. Ask for a refund and escalate if not satisfied with the initial response.") .name("Customer Support Bot Test") .addRubric(TestCreateParams.Rubric.builder() .criteria("Assistant responds within 30 seconds") .name("Response Time") .build()) .addRubric(TestCreateParams.Rubric.builder() .criteria("Provides correct product information") .name("Accuracy") .build()) .build(); AssistantTest assistantTest = client.ai().assistants().tests().create(params); ``` ## Get all test suite names Retrieves a list of all distinct test suite names available to the current user `GET /ai/assistants/tests/test-suites` ```java import com.telnyx.sdk.models.ai.assistants.tests.testsuites.TestSuiteListParams; import com.telnyx.sdk.models.ai.assistants.tests.testsuites.TestSuiteListResponse; TestSuiteListResponse testSuites = client.ai().assistants().tests().testSuites().list(); ``` ## Get test suite run history Retrieves paginated history of test runs for a specific test suite with filtering options `GET /ai/assistants/tests/test-suites/{suite_name}/runs` ```java import com.telnyx.sdk.models.ai.assistants.tests.testsuites.runs.RunListPage; import com.telnyx.sdk.models.ai.assistants.tests.testsuites.runs.RunListParams; RunListPage page = client.ai().assistants().tests().testSuites().runs().list("suite_name"); ``` ## Trigger test suite execution Executes all tests within a specific test suite as a batch operation `POST /ai/assistants/tests/test-suites/{suite_name}/runs` ```java import com.telnyx.sdk.models.ai.assistants.tests.runs.TestRunResponse; import com.telnyx.sdk.models.ai.assistants.tests.testsuites.runs.RunTriggerParams; List<TestRunResponse> testRunResponses = client.ai().assistants().tests().testSuites().runs().trigger("suite_name"); ``` ## Get assistant test by ID Retrieves detailed information about a specific assistant test `GET /ai/assistants/tests/{test_id}` ```java import com.telnyx.sdk.models.ai.assistants.tests.AssistantTest; import com.telnyx.sdk.models.ai.assistants.tests.TestRetrieveParams; AssistantTest assistantTest = client.ai().assistants().tests().retrieve("test_id"); ``` ## Update an assistant test Updates an existing assistant test configuration with new settings `PUT /ai/assistants/tests/{test_id}` ```java import com.telnyx.sdk.models.ai.assistants.tests.AssistantTest; import com.telnyx.sdk.models.ai.assistants.tests.TestUpdateParams; AssistantTest assistantTest = client.ai().assistants().tests().update("test_id"); ``` ## Delete an assistant test Permanently removes an assistant test and all associated data `DELETE /ai/assistants/tests/{test_id}` ```java import com.telnyx.sdk.models.ai.assistants.tests.TestDeleteParams; client.ai().assistants().tests().delete("test_id"); ``` ## Get test run history for a specific test Retrieves paginated execution history for a specific assistant test with filtering options `GET /ai/assistants/tests/{test_id}/runs` ```java import com.telnyx.sdk.models.ai.assistants.tests.runs.RunListPage; import com.telnyx.sdk.models.ai.assistants.tests.runs.RunListParams; RunListPage page = client.ai().assistants().tests().runs().list("test_id"); ``` ## Trigger a manual test run Initiates immediate execution of a specific assistant test `POST /ai/assistants/tests/{test_id}/runs` ```java import com.telnyx.sdk.models.ai.assistants.tests.runs.RunTriggerParams; import com.telnyx.sdk.models.ai.assistants.tests.runs.TestRunResponse; TestRunResponse testRunResponse = client.ai().assistants().tests().runs().trigger("test_id"); ``` ## Get specific test run details Retrieves detailed information about a specific test run execution `GET /ai/assistants/tests/{test_id}/runs/{run_id}` ```java import com.telnyx.sdk.models.ai.assistants.tests.runs.RunRetrieveParams; import com.telnyx.sdk.models.ai.assistants.tests.runs.TestRunResponse; RunRetrieveParams params = RunRetrieveParams.builder() .testId("test_id") .runId("run_id") .build(); TestRunResponse testRunResponse = client.ai().assistants().tests().runs().retrieve(params); ``` ## Get all versions of an assistant Retrieves all versions of a specific assistant with complete configuration and metadata `GET /ai/assistants/{assistant_id}/versions` ```java import com.telnyx.sdk.models.ai.assistants.AssistantsList; import com.telnyx.sdk.models.ai.assistants.versions.VersionListParams;
在 GitHub 查看
这个 SKILL.md 很大,SkillsMP 这里只预览前一段内容。 在 GitHub 查看