Skill 2.5.1
Create FM API interfaces to address the specific requirements of GenAI workloads (for example, by using API Gateway to handle streaming responses, token limit management, retry strategies to handle model timeouts)
Key Concepts
Generation can take longer than typical API timeouts, so interfaces stream responses or switch long jobs to an asynchronous pattern that returns a job ID. API Gateway REST APIs support response streaming and an integration timeout that can be raised beyond 29 seconds for Regional and private APIs (with a throttling quota trade-off), while WebSocket APIs suit interactive chat.
Token limit management counts or estimates input tokens before calling the model, truncates or summarises history to fit the context window, and sets maxTokens for responses. Retry strategies treat timeouts and throttling differently from validation errors: retry the first with backoff, fix the second.