-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hit summarizer API, improve summarizer models.
- Loading branch information
Showing
22 changed files
with
3,690 additions
and
479 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
app/src/main/kotlin/data/PathAlertsSummarizerApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ca.amandeep.path.data | ||
|
||
import android.content.Context | ||
import okhttp3.Cache | ||
import okhttp3.OkHttpClient | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.moshi.MoshiConverterFactory | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
interface PathAlertsSummarizerApiService { | ||
@GET("summarize") | ||
suspend fun summarize( | ||
@Query("input") input: String, | ||
) | ||
|
||
companion object { | ||
private const val API_PATH = "https://v8qv31w7hh.execute-api.us-east-1.amazonaws.com/dev/" | ||
|
||
fun create( | ||
applicationContext: Context, | ||
): PathAlertsSummarizerApiService = | ||
Retrofit.Builder() | ||
.baseUrl(API_PATH) | ||
.addConverterFactory(MoshiConverterFactory.create()) | ||
.client( | ||
OkHttpClient.Builder() | ||
// 2MB cache | ||
.cache(Cache(applicationContext.cacheDir, 2 * 1024 * 1024)) | ||
.build(), | ||
) | ||
.build() | ||
.create(PathAlertsSummarizerApiService::class.java) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ca.amandeep.path.data.model | ||
|
||
import androidx.compose.runtime.Immutable | ||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@Immutable | ||
@JsonClass(generateAdapter = true) | ||
data class AlertContainer( | ||
@Json(name = "ContentKey") val contentKey: String?, | ||
@Json(name = "Content") val content: String?, | ||
) |
Oops, something went wrong.