Package com.techcognita.javachatx.api
Interface ApiConnector
- All Known Implementing Classes:
BaseApiConnector,EchoApiConnector
public interface ApiConnector
Interface for connecting to external AI services and APIs.
Provides a standardized way to integrate with various AI providers.
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(com.google.gson.JsonObject configuration) Configure the API connector with necessary credentials and settings.getName()Get the name of this API connector.booleanisReady()Check if the connector is properly configured and ready to use.com.google.gson.JsonObjectsendRequest(com.google.gson.JsonObject request) Send a request to the external API and get a response.
-
Method Details
-
getName
String getName()Get the name of this API connector.- Returns:
- The connector name
-
sendRequest
Send a request to the external API and get a response.- Parameters:
request- The request data as a JSON object- Returns:
- The API response as a JSON object
- Throws:
ApiException- If there's an error communicating with the API
-
isReady
boolean isReady()Check if the connector is properly configured and ready to use.- Returns:
- true if the connector is ready, false otherwise
-
configure
void configure(com.google.gson.JsonObject configuration) Configure the API connector with necessary credentials and settings.- Parameters:
configuration- The configuration parameters as a JSON object
-