Skip to content

Conversation

@adamrefaey
Copy link
Collaborator

Change

  • Refactor AwsBedrockService medical analysis prompt and enhance PerplexityService prompts for clarity
  • Updated the medical analysis prompt in AwsBedrockService to streamline instructions and focus on key extraction points.
  • Improved the system and user prompts in PerplexityService for reviewing medical document analyses, emphasizing accuracy and clarity in the verification process.

Does this PR introduce a breaking change?

{...}

What needs to be documented once your changes are merged?

{...}

Additional Comments

{...}

…xityService prompts for clarity

- Updated the medical analysis prompt in AwsBedrockService to streamline instructions and focus on key extraction points.
- Improved the system and user prompts in PerplexityService for reviewing medical document analyses, emphasizing accuracy and clarity in the verification process.
…letion method

- Added PerplexityToolFunction, PerplexityTool, and PerplexityResponseFormat interfaces to support enhanced functionality.
- Introduced tools and response_format options in PerplexityRequest for improved API interactions.
- Implemented createStreamingChatCompletion method for querying the Perplexity AI API with streaming responses, including optional parameters for flexibility.
- Updated error handling in the new method to improve logging and error reporting.
@adamrefaey adamrefaey requested review from GuidoBR and Copilot April 25, 2025 17:14
@adamrefaey adamrefaey self-assigned this Apr 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactor prompts for medical analysis in AwsBedrockService and PerplexityService to improve clarity and enforce strict JSON output formats.

  • Updated PerplexityService interfaces and added optional parameters in chat completion requests, including streaming support.
  • Modified ReportsService to update reports using UpdateItemCommand and added report existence verification with updated timestamp.
  • Simplified and clarified the medical analysis prompt in AwsBedrockService to enforce strict JSON formatting and concise extraction instructions.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
backend/src/services/perplexity.service.ts Added new interfaces for tool functions and updated request optional parameters, including a new streaming chat completion method.
backend/src/reports/reports.service.ts Switched from PutItemCommand to UpdateItemCommand with additional report existence checks and updated timestamp support.
backend/src/document-processor/services/aws-bedrock.service.ts Refactored the medical analysis prompt to a more concise format with explicit formatting rules for JSON output.
Comments suppressed due to low confidence (2)

backend/src/services/perplexity.service.ts:17

  • [nitpick] Consider renaming the 'function' property to a more descriptive name (e.g., 'toolFunction') to avoid potential confusion with reserved keywords.
export interface PerplexityTool {

backend/src/reports/reports.service.ts:389

  • Consider including the 'id' attribute in the ConditionExpression to ensure that the update strictly targets the intended report, thereby enhancing data integrity.
UpdateExpression: 'SET title = :title, bookmarked = :bookmarked, category = :category, processingStatus = :processingStatus, labValues = :labValues, summary = :summary, confidence = :confidence, status = :status, updatedAt = :updatedAt',

- Revised the medical analysis prompt in AwsBedrockService tests to enhance clarity and focus on lab reports.
- Ensured consistency in prompt messaging across test cases.
@adamrefaey adamrefaey merged commit 2e2a3d1 into main Apr 25, 2025
1 check passed
@adamrefaey adamrefaey deleted the ADE-66 branch April 25, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants