1pub mod caches;
8pub mod callbacks;
9pub mod documents;
10pub mod embeddings;
11pub mod env;
12pub mod errors;
13pub mod example_selectors;
14pub mod globals;
15pub mod language_models;
16pub mod messages;
17pub mod rate_limiters;
18pub mod retrievers;
19pub mod runnables;
20pub mod serializable;
21pub mod structured_query;
22pub mod tools;
23pub mod utils;
24pub mod vectorstores;
25
26pub use caches::{BaseCache, CacheStats, CachedGenerations, InMemoryCache, TtlCache};
28pub use env::{RuntimeEnvironment, get_fresh_runtime_environment, get_runtime_environment};
29pub use errors::{
30 ErrorCode, FerricLinkError, IntoFerricLinkError, OutputParserException, Result,
31 TracerException, create_error_message,
32};
33pub use example_selectors::{
34 BaseExampleSelector, Example, LengthBasedExampleSelector, MaxMarginalRelevanceExampleSelector,
35 SemanticSimilarityExampleSelector, sorted_values,
36};
37pub use globals::{
38 clear_llm_cache, disable_debug, disable_verbose, enable_debug, enable_verbose, get_debug,
39 get_globals, get_verbose, globals_summary, has_llm_cache, init_globals, is_debug, is_verbose,
40 reset_globals, set_debug, set_llm_cache, set_verbose, toggle_debug, toggle_verbose,
41};
42pub use rate_limiters::{
43 AdvancedRateLimiter, BaseRateLimiter, InMemoryRateLimiter, InMemoryRateLimiterConfig,
44 RateLimiterConfig,
45};
46pub use serializable::Serializable;
47
48pub const VERSION: &str = env!("CARGO_PKG_VERSION");
50
51pub fn init() -> Result<()> {
56 init_globals()?;
58
59 #[cfg(not(docsrs))]
60 {
61 tracing_subscriber::fmt::init();
62 }
63 Ok(())
64}
65
66#[cfg(test)]
67mod tests {
68 use super::*;
69
70 #[test]
71 fn test_version() {
72 assert_ne!(VERSION, "", "Version should not be empty");
74 }
75
76 #[test]
77 fn test_init() {
78 let result = init();
81 if result.is_err() {
82 println!("Init failed (expected if globals already initialized): {result:?}",);
83 }
84 }
86}