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