def get_embedding()

in src/chat_request.py [0:0]


def get_embedding(question: str):
    embedding_model = os.environ["AZURE_OPENAI_EMBEDDING_MODEL"]

    connection = AzureOpenAIConnection(
        azure_deployment=embedding_model,
        api_version=azure_config.aoai_api_version,
        api_base=azure_config.aoai_endpoint
    )
    client = init_azure_openai_client(connection)

    return client.embeddings.create(
        input=question,
        model=embedding_model,
    ).data[0].embedding