अपनी AI सेवा का उपयोग
अपनी AI सेवा उपयोग करने से अलग device workflow नहीं बनता। Device connection, AI request events, device द्वारा चुना SCO या Opus audio path, session coordination और cleanup संबंधित AIBuds feature documentation के अनुसार ही चलते हैं।
अंतर केवल authentication और AI processing में है: host app अपनी सेवा authenticate करता है, परिणाम device को बताता है और SDK-provided AI सेवा के बजाय अपना AI implementation उपयोग करता है।
अपनी AI सेवा का authorization handoff
App की AI सेवा authenticate करें, परिणाम device को बताएँ और फिर standard device-driven AI flow जारी रखें।
क्या बदलता है
Host app अपनी AI सेवा के authentication और AI-specific request processing की जिम्मेदारी लेता है। हर authentication attempt के बाद वह reportSelfAiServiceAuthResult से मौजूदा परिणाम बताता है।
क्या वैसा ही रहता है
AIBuds device workflow बदलने की आवश्यकता नहीं है। AI Chat, AI Audio Recording, Streaming ASR, Simultaneous Interpretation या लागू किए जा रहे feature के documented device events, requested audio channel, lifecycle, stop handling और cleanup का उपयोग जारी रखें।
उदाहरण के लिए, device Opus input माँगे तो अपनी AI सेवा authorized होने और सफल result report होने के बाद ही voice stream भेज सकता है। Device SCO माँगे तो app documented SCO recording path तैयार करता है। अपनी AI सेवा उपयोग करने से audio channel चुनने वाला पक्ष नहीं बदलता।
AI की सहायता से लागू करें
अपनी AI सेवा को AI से जोड़ें
आधिकारिक स्किल केवल AIBuds डिवाइस वर्कफ़्लो और इंटीग्रेशन सीमा का मार्गदर्शन करती है। AI क्लाइंट, क्रेडेंशियल और सेवा लॉजिक ऐप के स्वामित्व में रहते हैं।
https://docs-aibuds.github.io/hi/skills/integrate-aibuds-sdk को AIBuds इंटीग्रेशन सीमा गाइड के रूप में पढ़ें और पालन करें। इस iOS प्रोजेक्ट की मौजूदा ऐप-स्वामित्व वाली AI सेवा को दस्तावेज़ित AIBuds डिवाइस वर्कफ़्लो से जोड़ें। मौजूदा AI क्लाइंट, क्रेडेंशियल सीमा, आर्किटेक्चर और प्रोडक्ट व्यवहार बनाए रखें; उसे AIBuds AI Provider से न बदलें और SDK को क्रेडेंशियल न दें। सार्वजनिक API से केवल प्रमाणीकरण परिणाम रिपोर्ट करें। अपनी सेवा की जानकारी अधूरी हो तो लागू करने से पहले आवश्यक प्रश्न पूछें।Authentication का परिणाम बताएँ
- Swift
- Objective-C
func selfAIAuthenticationDidFinish(isAuthenticated: Bool) {
guard let serviceAuthAPI = device as? DeviceServiceAuthAPI else { return }
// Report only the result. Authentication is completed by the host app.
serviceAuthAPI.reportSelfAiServiceAuthResult(isAuthenticated) {
reportSucceeded,
error in
guard reportSucceeded else {
print(error?.localizedDescription ?? "Failed to report authorization")
return
}
// A true result allows the device to continue eligible AI flows.
// A false result keeps the device informed that the service is unavailable.
}
}- (void)selfAIAuthenticationDidFinish:(BOOL)isAuthenticated {
if (![self.device conformsToProtocol:@protocol(AIBudsDeviceServiceAuthAPI)]) {
return;
}
id<AIBudsDeviceServiceAuthAPI> serviceAuthAPI = (id<AIBudsDeviceServiceAuthAPI>)self.device;
// Report only the result. Authentication is completed by the host app.
[serviceAuthAPI reportSelfAiServiceAuthResult:isAuthenticated
completion:^(BOOL reportSucceeded, NSError *error) {
if (!reportSucceeded) {
NSLog(@"%@", error.localizedDescription);
return;
}
// A true result allows the device to continue eligible
// AI flows. A false result keeps the device informed
// that the service is unavailable.
}];
}पूरे API contract के लिए reportSelfAiServiceAuthResult और अपनी AI सेवा का authorization परिणाम बताएँ देखें।
:::note Completion का अर्थ Completion handler केवल बताता है कि Boolean result device तक पहुँचा या नहीं। यह host app द्वारा AI सेवा के सफल authentication की पुष्टि नहीं करता। इस API से token, API key या अन्य credentials न भेजें। :::
Integration checklist
- Host app में अपनी AI सेवा authenticate करें।
- Service AI requests के लिए ready हो तभी
truereport करें। - Authentication fail होने या service unavailable होने पर
falsereport करें। - चुने गए AI feature का documented device event, SCO या Opus, session और cleanup flow जारी रखें।
- Credentials को app की secure service integration में रखें; device को केवल Boolean result बताएँ।