Interacting with Integrations
Interacting with Your Integrations
The Tror Gen AI SDK offers two primary methods for interacting with your created integrations:
-
Iframe Embedding: Integrate the functionality visually within your web interfaces.
-
API Access: Interact with the integration programmatically for advanced use cases.
Iframe Integration
If you choose to embed your integration visually within your application, you can leverage the generated iframe code.
Generating Iframe Code
integration = # Your created integration object
iframe_code = integration.get_iframe_code()
The get_iframe_code method retrieves the HTML code for embedding the integration as an iframe.
Using the Iframe Code
-
Integrate the retrieved iframe_code into your web page's HTML structure.
-
This will create a designated area within your interface where users can interact with the LLM functionality of your chosen integration.
Example Iframe Usage:
<iframe srcdoc="<%= iframe_code %>" width="600" height="400"></iframe>
API Interaction
For programmatic interaction and advanced use cases, you can leverage the dedicated API endpoint provided by your integration. Obtaining the API Endpoint
integration = # Your created integration object
api_endpoint = integration.get_api_endpoint()
The get_api_endpoint method retrieves the API URL for programmatic interaction with the integration.
Using the API Endpoint
Choosing the Right Method:
The selection between iframe and API depends on your specific needs.
-
Iframe: Ideal for simple visual integration within your web interface.
-
API: Suitable for complex use cases requiring programmatic control and interaction.