Skip to content

Commit

Permalink
Change findRelevantPassages api to POST (#136)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Sundberg <[email protected]>
  • Loading branch information
seansund authored Nov 6, 2023
1 parent edcebea commit b8490dc
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/controllers/data-extraction/data-extraction.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import {Controller, Get, Post, Query} from "@nestjs/common";
import {Body, Controller, Get, Post, Query} from "@nestjs/common";
import {ApiProperty, ApiTags} from "@nestjs/swagger";

import {DataExtractionApi} from "../../services/data-extraction";
import {ApiTags} from "@nestjs/swagger";
import {DataExtractionApi} from "../../services";

class FindPassagesInput {
@ApiProperty()
question: string;
@ApiProperty()
passages: string[] = []
}

@ApiTags('data-extraction')
@Controller('data-extraction')
Expand Down Expand Up @@ -38,13 +45,10 @@ export class DataExtractionController {
.catch(err => console.error(err))
}

@Get('findRelevantPassages')
@Post('findRelevantPassages')
async findRelevantPassages(
@Query('question') question: string,
@Query('passages') passages: string[] = []
@Body() input: FindPassagesInput
): Promise<string> {
const passageVals = Array.isArray(passages) ? passages : [passages]

return this.service.findRelevantPassages(question, passageVals)
return this.service.findRelevantPassages(input.question, input.passages)
}
}

0 comments on commit b8490dc

Please sign in to comment.