sim_codec_chat/providers/
anthropic.rs1mod common;
8mod decode;
9mod encode;
10mod runtime;
11
12pub use decode::{
13 decode_anthropic_request, decode_anthropic_response, decode_anthropic_stream,
14 decode_anthropic_stream_events,
15};
16pub use encode::{encode_anthropic_request, encode_anthropic_response};
17pub use runtime::{AnthropicCodec, AnthropicCodecLib};
18
19use sim_kernel::{CodecId, Symbol};
20
21pub(super) const ANTHROPIC_CODEC_ID: CodecId = CodecId(0);
22
23#[derive(Clone, Debug, PartialEq, Eq)]
25pub struct AnthropicCodecOptions {
26 pub model: String,
28 pub max_tokens: u64,
30 pub stream: bool,
32 pub tools: bool,
34}
35
36impl AnthropicCodecOptions {
37 pub fn new(model: impl Into<String>, max_tokens: u64, stream: bool, tools: bool) -> Self {
39 Self {
40 model: model.into(),
41 max_tokens,
42 stream,
43 tools,
44 }
45 }
46}
47
48pub type AnthropicRequestOptions = AnthropicCodecOptions;
50
51pub fn anthropic_codec_symbol() -> Symbol {
53 Symbol::qualified("codec", "anthropic")
54}