Skip to content

Commit

Permalink
SerpAPI bug fixed (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
javipacheco authored Jan 9, 2024
1 parent 3acb85b commit 180e829
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ suspend fun main() {

val answer = client.search(searchData)

answer.searchResults.forEach {
answer.searchResults?.forEach {
println(
"\n\uD83E\uDD16 Search Information:\n\n" +
"Title: ${it.title}\n" +
"Document: ${it.document}\n" +
"Source: ${it.source}\n"
)
}
} ?: println("No results found")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class SearchResults(@SerialName("organic_results") val searchResults: List<SearchResult>)
data class SearchResults(@SerialName("organic_results") val searchResults: List<SearchResult>?)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface SearchTool : Tool {
prompt =
Prompt(model) {
+system("Search results:")
docs.searchResults.take(maxResultsInContext).forEach {
docs.searchResults?.take(maxResultsInContext)?.forEach {
+system("Title: ${it.title}")
+system("Source: ${it.source}")
+system("Content: ${it.document}")
Expand Down

0 comments on commit 180e829

Please sign in to comment.