File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change
1
+
2
+ .codegpt
Original file line number Diff line number Diff line change @@ -56,10 +56,20 @@ findPlaces text = do
56
56
-- Strip leading and trailing whitespace from each place name
57
57
return $ map (T. unpack . T. strip . T. pack) places
58
58
59
+ findPeople :: String -> IO [String ]
60
+ findPeople text = do
61
+ let prompt = " Extract only the person names separated by commas from the following text:\n\n " ++ text
62
+ response <- completionRequestToString prompt
63
+ let people = filter (not . null ) $ map T. unpack $ splitOn " ," (T. pack response)
64
+ return $ map (T. unpack . T. strip . T. pack) people
65
+
59
66
main :: IO ()
60
67
main = do
61
68
response <- completionRequestToString " Write a hello world program in Haskell"
62
69
putStrLn response
63
70
64
71
places <- findPlaces " I visited London, Paris, and New York last year."
65
- print places
72
+ print places
73
+
74
+ people <- findPeople " John Smith met with Sarah Johnson and Michael Brown at the conference."
75
+ print people
You can’t perform that action at this time.
0 commit comments