Coverage for src / agent / config / defaults.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-11 14:30 +0000

1# Copyright 2025-2026 Microsoft Corporation 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15"""Default configuration values for OSDU Agent.""" 

16 

17# Import and re-export all constants for backward compatibility 

18from .constants import ( 

19 DEFAULT_ANTHROPIC_MODEL, 

20 DEFAULT_AZURE_API_VERSION, 

21 DEFAULT_CONFIG_PATH, 

22 DEFAULT_DATA_DIR, 

23 DEFAULT_GEMINI_MODEL, 

24 DEFAULT_GITHUB_ENDPOINT, 

25 DEFAULT_GITHUB_MODEL, 

26 DEFAULT_LOCAL_BASE_URL, 

27 DEFAULT_LOCAL_MODEL, 

28 DEFAULT_MEMORY_DIR, 

29 DEFAULT_MEMORY_HISTORY_LIMIT, 

30 DEFAULT_MEMORY_TYPE, 

31 DEFAULT_OPENAI_MODEL, 

32 DEFAULT_OTLP_ENDPOINT, 

33 DEFAULT_SESSION_DIR, 

34) 

35from .schema import AgentSettings 

36 

37__all__ = [ 

38 "get_default_config", 

39 "DEFAULT_CONFIG_PATH", 

40 "DEFAULT_DATA_DIR", 

41 "DEFAULT_MEMORY_DIR", 

42 "DEFAULT_SESSION_DIR", 

43 "DEFAULT_LOCAL_BASE_URL", 

44 "DEFAULT_LOCAL_MODEL", 

45 "DEFAULT_OPENAI_MODEL", 

46 "DEFAULT_ANTHROPIC_MODEL", 

47 "DEFAULT_AZURE_API_VERSION", 

48 "DEFAULT_GEMINI_MODEL", 

49 "DEFAULT_GITHUB_MODEL", 

50 "DEFAULT_GITHUB_ENDPOINT", 

51 "DEFAULT_OTLP_ENDPOINT", 

52 "DEFAULT_MEMORY_TYPE", 

53 "DEFAULT_MEMORY_HISTORY_LIMIT", 

54] 

55 

56 

57def get_default_config() -> AgentSettings: 

58 """Get default configuration settings. 

59 

60 Returns: 

61 AgentSettings with sensible defaults: 

62 - No providers enabled (explicit configuration required) 

63 - Telemetry disabled 

64 - In-memory storage for conversation history 

65 - Data directory at ~/.osdu-agent 

66 

67 Example: 

68 >>> config = get_default_config() 

69 >>> config.providers.enabled 

70 [] 

71 >>> config.telemetry.enabled 

72 False 

73 """ 

74 return AgentSettings( 

75 version="1.0", 

76 providers={ # type: ignore[arg-type] 

77 "enabled": [], # No providers by default - explicit config required 

78 "local": { 

79 "base_url": DEFAULT_LOCAL_BASE_URL, 

80 "model": DEFAULT_LOCAL_MODEL, 

81 }, 

82 "openai": { 

83 "enabled": False, 

84 "api_key": None, 

85 "model": DEFAULT_OPENAI_MODEL, 

86 }, 

87 "anthropic": { 

88 "enabled": False, 

89 "api_key": None, 

90 "model": DEFAULT_ANTHROPIC_MODEL, 

91 }, 

92 "azure": { 

93 "enabled": False, 

94 "endpoint": None, 

95 "deployment": None, 

96 "api_version": DEFAULT_AZURE_API_VERSION, 

97 "api_key": None, 

98 }, 

99 "foundry": { 

100 "enabled": False, 

101 "project_endpoint": None, 

102 "model_deployment": None, 

103 }, 

104 "gemini": { 

105 "enabled": False, 

106 "api_key": None, 

107 "model": DEFAULT_GEMINI_MODEL, 

108 "use_vertexai": False, 

109 "project_id": None, 

110 "location": None, 

111 }, 

112 "github": { 

113 "enabled": False, 

114 "token": None, 

115 "model": DEFAULT_GITHUB_MODEL, 

116 "endpoint": DEFAULT_GITHUB_ENDPOINT, 

117 "org": None, 

118 }, 

119 }, 

120 agent={ # type: ignore[arg-type] 

121 "data_dir": "~/.osdu-agent", 

122 "log_level": "info", 

123 }, 

124 telemetry={ # type: ignore[arg-type] 

125 "enabled": False, 

126 "enable_sensitive_data": False, 

127 "otlp_endpoint": "http://localhost:4317", 

128 "applicationinsights_connection_string": None, 

129 }, 

130 memory={ # type: ignore[arg-type] 

131 "enabled": True, 

132 "type": "in_memory", 

133 "history_limit": 20, 

134 "mem0": { 

135 "storage_path": None, 

136 "api_key": None, 

137 "org_id": None, 

138 "user_id": None, 

139 "project_id": None, 

140 }, 

141 }, 

142 )