blob: afdb610986ff10477fd745e088b4e2b8577195ef [file] [log] [blame]
ben-aaron1883818e7c2022-09-08 17:49:01 +02001gpt3.make_embedding = function(model_ = 'text-similarity-ada-001'
2 , input_){
3
4 parameter_list = list(model = model_
5 , input = input_)
6
7 request_base = httr::POST(url = url.embeddings
8 , body = parameter_list
9 , httr::add_headers(Authorization = paste("Bearer", api_key))
10 , encode = "json")
11
12
13 output_base = httr::content(request_base)
14
15 embedding_raw = toNumeric(unlist(output_base$data[[1]]$embedding))
16
17 return(embedding_raw)
18
19}