Learn how to create a custom backend provider for Cedar-OS by implementing the required provider interface functions.
callLLM
)callLLMStructured
)streamLLM
)handleResponse
, handleStreamResponse
)ProviderImplementation
interface with these 5 required functions:
callLLM
- Basic LLM CallscallLLMStructured
- Structured Output CallscallLLM
, but with the object
field populated with parsed structured data.
Example Implementation:
streamLLM
- Streaming Responsesparams
as callLLM
handler
: A callback function to process stream eventshandleResponse
- Parse API ResponsesLLMResponse
format.
Input: Standard Response
object from fetch
Output: LLMResponse
object
Example Implementation:
handleStreamResponse
- Parse Stream ChunksStreamEvent
objects.
Input: Raw string chunk from the stream
Output: StreamEvent
object
Example Implementation:
packages/cedar-os/src/store/agentConnection/providers/index.ts
:
AbortController