import { Lira } from 'lira'
const lira = new Lira()
await lira.store.anthropic.message({
input: MessageCreateParamsBase & LiraMetadata
output?: Stream<RawMessageStreamEvent> | Message
reqTime?: { start: number; end: number }
error?: unknown
})
Options object
input
MessageCreateParamsBase & LiraMetadata
required
MessageCreateParamsBase is exactly the same as the one defined in the Anthropic API documentation.{
...MessageCreateParamsBase
endUser?: {
id: string
name?: string
passIdToUnderlyingLLM?: boolean
}
sessionId?: string
tags?: string[]
store?: {
disabled?: boolean
callback?: LiraStore.Callback
}
}
output
Stream<RawMessageStreamEvent> | Message
reqTime
{ start: number; end: number }
The time it took to process the request. In order to calculate the time it took to process the request, you can use the following code:const start = Date.now()
await anthropic.messages.create()
const end = Date.now()
const reqTime = { start, end }
The error that occurred while processing the request.