Calling Gen AI programmatically via an API; and, persisting themes and context

Finn Wredenhagen 0 Reputation points
2025-02-22T04:19:33.8666667+00:00

I am writing a book and I prefer to be able to generate images and store the results automatically.

I have two questions:

  1. Is it possible to call Microsoft's gen AI engine via a Python (or any language) interface?
  2. Is there a set of primitives or directives that define the language around image generation? For example, if I want to stick with a certain theme, or say I have described a character in detail and I want to reuse that character in different contexts, how to I refer to the character without having to redefine him for every image?
Microsoft Copilot
Microsoft Copilot
Microsoft terminology for a universal copilot interface.
604 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Martin Brandl 470 Reputation points MVP
    2025-02-22T09:52:18.82+00:00

    Yes, Microsoft Azure OpenAI Service provides REST APIs and SDKs (like Python) to interact with generative models, including image generation (like DALL·E through OpenAI integration). See: The Azure AI Foundry SDK

    Consistency in character and theme is challenging because generative models typically work statelessly. However, you can for example write an agent using Azure AI Agent Service that has a system prompt that includes your general / character description. Then you only need to send the description for the current picture as a user message. But I would deal with it and always send a complete prompt when generating the image.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.