-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrated agent, live evaluations
+ feat: evaluations run against live app + feat: deployed LLM agent to Functions + feat: integrated agent into app
- Loading branch information
Showing
18 changed files
with
451 additions
and
117 deletions.
There are no files selected for viewing
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,49 @@ | ||
package ai | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/vartanbeno/go-reddit/v2/reddit" | ||
) | ||
|
||
const subredditName = "travel" | ||
|
||
func getRedditPosts(location string) (string, error) { | ||
client, err := reddit.NewReadonlyClient() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
ctx := context.Background() | ||
posts, _, err := client.Subreddit.SearchPosts(ctx, location, subredditName, &reddit.ListPostSearchOptions{ | ||
ListPostOptions: reddit.ListPostOptions{ | ||
ListOptions: reddit.ListOptions{ | ||
Limit: 5, | ||
}, | ||
Time: "all", | ||
}, | ||
}) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
response := "" | ||
|
||
for _, post := range posts { | ||
if post.Body != "" { | ||
|
||
postAndComments, _, err := client.Post.Get(ctx, post.ID) | ||
if err != nil { | ||
response += fmt.Sprintf("Title: %s, Post: %s", | ||
post.Title, post.Body) | ||
continue | ||
} | ||
|
||
response += fmt.Sprintf("Title: %s, Post: %s, Top Comment:\n", | ||
post.Title, post.Body, postAndComments.Comments[0]) | ||
} | ||
} | ||
|
||
return response, nil | ||
} |
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
Oops, something went wrong.