Skip to content

Conversation

Kartikayy007
Copy link

@Kartikayy007 Kartikayy007 commented Mar 9, 2025

Resolves #80

Feature: AQA Support via generateAnswer()

What's changed

Implements the requested AQA (Attributed Question Answering) support by adding:

  • New generateAnswer() method in GenerativeModel class
  • Task.GENERATE_ANSWER enum value
  • Defined GenerateAnswerRequest and GenerateAnswerResponse interfaces
  • Updated tests

Testing

  • Verified against AQA API endpoints
  • Added comprehensive test cases

Example Usage

import {GoogleGenerativeAI} from '@google/generative-ai';

const genAI = new GoogleGenerativeAI(API_KEY);
const model = genAI.getGenerativeModel({model: 'models/aqa'});

try {
  const result = await model.generateAnswer({
    input: "What causes seasons?",
    sources: [{
      title: "NASA Earth Facts",
      content: "Earth's axial tilt causes seasonal variations..."
    }],
    temperature: 0.7
  });
  
  console.log('Answer:', result.answer);
  console.log('Confidence:', result.confidenceScore);
} catch (err) {
  console.error('AQA Error:', err);
}

Implements the generateAnswer() method to support Attributed Question Answering models.
Includes type definitions and tests.

Resolves google-gemini#80
@Kartikayy007
Copy link
Author

@IvanLH @hsubox76 Could I get your review on this AQA implementation when you have time?

@Kartikayy007
Copy link
Author

hey @hkt74 do this feature implementation seem fine?

@Annhiluc Annhiluc added type:feature request New feature request/enhancement status:triaged Issue/PR triaged to the corresponding sub-team p3 labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 status:triaged Issue/PR triaged to the corresponding sub-team type:feature request New feature request/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Where is the generateAnswer() method?
2 participants