Generating Structured JSON Output with Local Llamafile

2025-06-26

This article demonstrates how to generate structured JSON outputs from Llamafile, a locally runnable LLM. By leveraging LangChain's JsonOutputParser and PromptTemplate, and defining a custom Answer class to specify the desired JSON structure, the author chains together prompt, LLM, and parser components. This cleverly bypasses Llamafile's lack of built-in structured output functionality. A practical example using Llama-3.2-1B-Instruct-Q8_0.llamafile is provided, along with a link to the complete source code.

Read more
Development JSON output

Secure Your Angular App with Keycloak and the BFF Pattern

2025-01-28

This article demonstrates building a secure web application using the Backend for Frontend (BFF) pattern, integrating Keycloak and Angular. To avoid storing sensitive data in the browser, authentication flows with Keycloak are entirely handled by a dedicated BFF server. The BFF acts as a secure intermediary between Keycloak and the Angular app, managing OAuth2 and PKCE flows, securely storing tokens, and preventing sensitive operations (like token refresh) from reaching the browser. The Angular app interacts only with simplified endpoints provided by the BFF, eliminating direct communication with Keycloak. The article details Keycloak configuration, BFF server setup (using Express.js), and Angular app development, highlighting the security benefits of this architecture.

Read more
Development BFF pattern