Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: article extender question/answer models + service #615

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions stroeer/core/v1/article.proto
Original file line number Diff line number Diff line change
Expand Up @@ -681,14 +681,14 @@ message Article {
* Each `Body` has a `Body.Type` to help the consumer to correctly interpret
* the [`BodyNode's`][bn] content.
*
* | Enum value | Description |
* |---------------------|---------------------------------------------------------------------------------------------------------------------------|
* | `TYPE_UNSPECIFIED` | unspecified |
* | `BODY` | The textual article body including all inline elements such as `IMAGE`, `VIDEO` and `EMBED` |
* | `ARTICLE_SOURCES` | A wrapper for all article sources ("Quellenaparat"). There can only be one of these per article. |
* | `DISCLAIMER` | A article disclaimer with important notes/legal stuff. E.g. "medizinischer Hinweis" on all medical articles |
* | `TRUST_BOX` | Includes information what the current article type is (e.g. opinion article). There can only be one of these per article. |
* | `TABLE_OF_CONTENTS` | Table of contents for this article, consists of anchors which refer to sub headlines within the `BODY` |
* | Enum value | Description |
* |---------------------|-------------------------------------------------------------------------------------------------------------|
* | `TYPE_UNSPECIFIED` | unspecified |
* | `BODY` | The textual article body including all inline elements such as `IMAGE`, `VIDEO` and `EMBED` |
* | `ARTICLE_SOURCES` | A wrapper for all article sources ("Quellenaparat"). There can only be one of these per article. |
* | `DISCLAIMER` | A article disclaimer with important notes/legal stuff. E.g. "medizinischer Hinweis" on all medical articles |
* | `TABLE_OF_CONTENTS` | Table of contents for this article, consists of anchors which refer to sub headlines within the `BODY` |
* | `ARTICLE_EXTENDER` | AI generated questions for the article for more engagement. |
*
* @CodeBlockStart protobuf
*/
Expand All @@ -697,8 +697,9 @@ message Article {
BODY = 1;
ARTICLE_SOURCES = 2;
DISCLAIMER = 3;
TRUST_BOX = 4;
TRUST_BOX = 4 [deprecated = true];
TABLE_OF_CONTENTS = 5;
ARTICLE_EXTENDER = 6;
}
/** @CodeBlockEnd */

Expand Down Expand Up @@ -779,7 +780,7 @@ message Article {
* | `quote` | inline quotation element, check `elements` |
* | `infobox` | inline box, consists of textual content in `children` and optional `elements` |
* | `pros_and_cons` | pros and cons box, consists of `elements` and structured text in `children` |
*
* | `question` | article extender: ai generated question |
*/
}

Expand Down
30 changes: 28 additions & 2 deletions stroeer/page/article/v1/article_extender_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ syntax = "proto3";

package stroeer.page.article.v1;

import "stroeer/core/v1/article.proto";

option go_package = "github.com/stroeer/go-tapir/page/article/v1;article";

/**
Expand All @@ -15,6 +17,7 @@ option go_package = "github.com/stroeer/go-tapir/page/article/v1;article";
*/
service ArticleExtenderService {
rpc GetQuestions(GetQuestionsRequest) returns (GetQuestionsResponse) {}
rpc GetAnswer(GetAnswerRequest) returns (GetAnswerResponse) {}
}
/** @CodeBlockEnd */

Expand All @@ -24,7 +27,7 @@ service ArticleExtenderService {
* rpc GetQuestions(GetQuestionsRequest) returns (GetQuestionsResponse) {}
* ```
*
* returns an array of questions if the given `id` exists, in the vector store,
* Returns an array of questions if the given `id` exists, in the vector store,
* an `Error`, otherwise.
*
* | Field name | Type | Description |
Expand All @@ -33,11 +36,34 @@ service ArticleExtenderService {
*
* @CodeBlockStart protobuf
*/

message GetQuestionsRequest {
int64 id = 1;
}

message GetQuestionsResponse {
repeated string questions = 1;
}

/**
* # `⚙︎ GetAnswer`
* ```protobuf
* rpc GetAnswer(GetAnswerRequest) returns (GetAnswerResponse) {}
* ```
*
* Returns the answer of a question as a string. Otherwise an `Error`.
*
* | Field name | Type | Description |
* |------------------|---------------------|---------------------------------------------------|
* | `question` | `string` | [required] The question for the returned answers. |
*
* @CodeBlockStart protobuf
*/
message GetAnswerRequest {
string question = 1;
}

message GetAnswerResponse {
string answer_text = 1;
bobaaaaa marked this conversation as resolved.
Show resolved Hide resolved
repeated stroeer.core.v1.Article answer_sources = 2;
repeated string next_questions = 3;
bobaaaaa marked this conversation as resolved.
Show resolved Hide resolved
}
Loading