embed method
Generate embeddings for the given input texts
input
- List of strings to generate embeddings for
Returns a list of embedding vectors or throws an LLMError
Implementation
@override
Future<List<List<double>>> embed(List<String> input) async {
if (config.apiKey.isEmpty) {
throw const AuthError('Missing xAI API key');
}
final requestBody = _buildEmbeddingRequest(input);
final responseData = await client.postJson(embeddingEndpoint, requestBody);
return _parseEmbeddingResponse(responseData);
}