1. 학습
  2. /
  3. 강의
  4. /
  5. Introduction to Embeddings with the OpenAI API

Connected

연습 문제

More repeatable embeddings

As you continue to work with embeddings, you'll find yourself making repeated calls to OpenAI's embedding model. To make these calls in a more repeatable and modular way, it would be better to define a custom function called create_embeddings() that would output embeddings for any number of text inputs. In this exercise, you'll do just that!

지침

100 XP
  • Define a create_embeddings() function that sends an input, texts, to the embedding model, and returns a list containing the embeddings for each input text.
  • Embed short_description using create_embeddings(), and extract and print the embeddings in a single list.
  • Embed list_of_descriptions using create_embeddings() and print.