test_config.py 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. import os
  2. import pytest
  3. from opendevin.core.config import (
  4. AgentConfig,
  5. AppConfig,
  6. LLMConfig,
  7. UndefinedString,
  8. finalize_config,
  9. get_llm_config_arg,
  10. load_from_env,
  11. load_from_toml,
  12. )
  13. @pytest.fixture
  14. def setup_env():
  15. # Create old-style and new-style TOML files
  16. with open('old_style_config.toml', 'w') as f:
  17. f.write('[default]\nLLM_MODEL="GPT-4"\n')
  18. with open('new_style_config.toml', 'w') as f:
  19. f.write('[app]\nLLM_MODEL="GPT-3"\n')
  20. yield
  21. # Cleanup TOML files after the test
  22. os.remove('old_style_config.toml')
  23. os.remove('new_style_config.toml')
  24. @pytest.fixture
  25. def temp_toml_file(tmp_path):
  26. # Fixture to create a temporary directory and TOML file for testing
  27. tmp_toml_file = os.path.join(tmp_path, 'config.toml')
  28. yield tmp_toml_file
  29. @pytest.fixture
  30. def default_config(monkeypatch):
  31. # Fixture to provide a default AppConfig instance
  32. AppConfig.reset()
  33. yield AppConfig()
  34. def test_compat_env_to_config(monkeypatch, setup_env):
  35. # Use `monkeypatch` to set environment variables for this specific test
  36. monkeypatch.setenv('WORKSPACE_BASE', '/repos/opendevin/workspace')
  37. monkeypatch.setenv('LLM_API_KEY', 'sk-proj-rgMV0...')
  38. monkeypatch.setenv('LLM_MODEL', 'gpt-4o')
  39. monkeypatch.setenv('AGENT_MEMORY_MAX_THREADS', '4')
  40. monkeypatch.setenv('AGENT_MEMORY_ENABLED', 'True')
  41. monkeypatch.setenv('DEFAULT_AGENT', 'CodeActAgent')
  42. monkeypatch.setenv('SANDBOX_TYPE', 'local')
  43. monkeypatch.setenv('SANDBOX_TIMEOUT', '10')
  44. config = AppConfig()
  45. load_from_env(config, os.environ)
  46. assert config.workspace_base == '/repos/opendevin/workspace'
  47. assert isinstance(config.get_llm_config(), LLMConfig)
  48. assert config.get_llm_config().api_key == 'sk-proj-rgMV0...'
  49. assert config.get_llm_config().model == 'gpt-4o'
  50. assert isinstance(config.get_agent_config(), AgentConfig)
  51. assert isinstance(config.get_agent_config().memory_max_threads, int)
  52. assert config.get_agent_config().memory_max_threads == 4
  53. assert config.get_agent_config().memory_enabled is True
  54. assert config.default_agent == 'CodeActAgent'
  55. assert config.sandbox.box_type == 'local'
  56. assert config.sandbox.timeout == 10
  57. def test_load_from_old_style_env(monkeypatch, default_config):
  58. # Test loading configuration from old-style environment variables using monkeypatch
  59. monkeypatch.setenv('LLM_API_KEY', 'test-api-key')
  60. monkeypatch.setenv('AGENT_MEMORY_ENABLED', 'True')
  61. monkeypatch.setenv('DEFAULT_AGENT', 'PlannerAgent')
  62. monkeypatch.setenv('WORKSPACE_BASE', '/opt/files/workspace')
  63. monkeypatch.setenv('SANDBOX_CONTAINER_IMAGE', 'custom_image')
  64. load_from_env(default_config, os.environ)
  65. assert default_config.get_llm_config().api_key == 'test-api-key'
  66. assert default_config.get_agent_config().memory_enabled is True
  67. assert default_config.default_agent == 'PlannerAgent'
  68. assert default_config.workspace_base == '/opt/files/workspace'
  69. assert (
  70. default_config.workspace_mount_path is UndefinedString.UNDEFINED
  71. ) # before finalize_config
  72. assert (
  73. default_config.workspace_mount_path_in_sandbox is not UndefinedString.UNDEFINED
  74. )
  75. assert default_config.sandbox.container_image == 'custom_image'
  76. def test_load_from_new_style_toml(default_config, temp_toml_file):
  77. # Test loading configuration from a new-style TOML file
  78. with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
  79. toml_file.write(
  80. """
  81. [llm]
  82. model = "test-model"
  83. api_key = "toml-api-key"
  84. [llm.cheap]
  85. model = "some-cheap-model"
  86. api_key = "cheap-model-api-key"
  87. [agent]
  88. memory_enabled = true
  89. [agent.BrowsingAgent]
  90. llm_config = "cheap"
  91. memory_enabled = false
  92. [sandbox]
  93. timeout = 1
  94. [core]
  95. workspace_base = "/opt/files2/workspace"
  96. default_agent = "TestAgent"
  97. sandbox_type = "local"
  98. """
  99. )
  100. load_from_toml(default_config, temp_toml_file)
  101. # default llm & agent configs
  102. assert default_config.default_agent == 'TestAgent'
  103. assert default_config.get_llm_config().model == 'test-model'
  104. assert default_config.get_llm_config().api_key == 'toml-api-key'
  105. assert default_config.get_agent_config().memory_enabled is True
  106. # undefined agent config inherits default ones
  107. assert (
  108. default_config.get_llm_config_from_agent('CodeActAgent')
  109. == default_config.get_llm_config()
  110. )
  111. assert default_config.get_agent_config('CodeActAgent').memory_enabled is True
  112. # defined agent config overrides default ones
  113. assert default_config.get_llm_config_from_agent(
  114. 'BrowsingAgent'
  115. ) == default_config.get_llm_config('cheap')
  116. assert (
  117. default_config.get_llm_config_from_agent('BrowsingAgent').model
  118. == 'some-cheap-model'
  119. )
  120. assert default_config.get_agent_config('BrowsingAgent').memory_enabled is False
  121. assert default_config.workspace_base == '/opt/files2/workspace'
  122. assert default_config.sandbox.box_type == 'local'
  123. assert default_config.sandbox.timeout == 1
  124. # default config doesn't have a field sandbox_type
  125. assert not hasattr(default_config, 'sandbox_type')
  126. # before finalize_config, workspace_mount_path is UndefinedString.UNDEFINED if it was not set
  127. assert default_config.workspace_mount_path is UndefinedString.UNDEFINED
  128. assert (
  129. default_config.workspace_mount_path_in_sandbox is not UndefinedString.UNDEFINED
  130. )
  131. assert default_config.workspace_mount_path_in_sandbox == '/workspace'
  132. finalize_config(default_config)
  133. # after finalize_config, workspace_mount_path is set to the absolute path of workspace_base
  134. # if it was undefined
  135. assert default_config.workspace_mount_path == '/opt/files2/workspace'
  136. def test_compat_load_sandbox_from_toml(default_config, temp_toml_file):
  137. # test loading configuration from a new-style TOML file
  138. # uses a toml file with sandbox_vars instead of a sandbox section
  139. with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
  140. toml_file.write(
  141. """
  142. [llm]
  143. model = "test-model"
  144. [agent]
  145. memory_enabled = true
  146. [core]
  147. workspace_base = "/opt/files2/workspace"
  148. sandbox_type = "local"
  149. sandbox_timeout = 500
  150. sandbox_container_image = "node:14"
  151. sandbox_user_id = 1001
  152. default_agent = "TestAgent"
  153. """
  154. )
  155. load_from_toml(default_config, temp_toml_file)
  156. assert default_config.get_llm_config().model == 'test-model'
  157. assert default_config.get_llm_config_from_agent().model == 'test-model'
  158. assert default_config.default_agent == 'TestAgent'
  159. assert default_config.get_agent_config().memory_enabled is True
  160. assert default_config.workspace_base == '/opt/files2/workspace'
  161. assert default_config.sandbox.box_type == 'local'
  162. assert default_config.sandbox.timeout == 500
  163. assert default_config.sandbox.container_image == 'node:14'
  164. assert default_config.sandbox.user_id == 1001
  165. assert default_config.workspace_mount_path_in_sandbox == '/workspace'
  166. finalize_config(default_config)
  167. # app config doesn't have fields sandbox_*
  168. assert not hasattr(default_config, 'sandbox_type')
  169. assert not hasattr(default_config, 'sandbox_timeout')
  170. assert not hasattr(default_config, 'sandbox_container_image')
  171. assert not hasattr(default_config, 'sandbox_user_id')
  172. # after finalize_config, workspace_mount_path is set to the absolute path of workspace_base
  173. # if it was undefined
  174. assert default_config.workspace_mount_path == '/opt/files2/workspace'
  175. def test_env_overrides_compat_toml(monkeypatch, default_config, temp_toml_file):
  176. # test that environment variables override TOML values using monkeypatch
  177. # uses a toml file with sandbox_vars instead of a sandbox section
  178. with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
  179. toml_file.write("""
  180. [llm]
  181. model = "test-model"
  182. api_key = "toml-api-key"
  183. [core]
  184. workspace_base = "/opt/files3/workspace"
  185. sandbox_type = "local"
  186. disable_color = true
  187. sandbox_timeout = 500
  188. sandbox_user_id = 1001
  189. """)
  190. monkeypatch.setenv('LLM_API_KEY', 'env-api-key')
  191. monkeypatch.setenv('WORKSPACE_BASE', 'UNDEFINED')
  192. monkeypatch.setenv('SANDBOX_TYPE', 'e2b')
  193. monkeypatch.setenv('SANDBOX_TIMEOUT', '1000')
  194. monkeypatch.setenv('SANDBOX_USER_ID', '1002')
  195. load_from_toml(default_config, temp_toml_file)
  196. # before finalize_config, workspace_mount_path is UndefinedString.UNDEFINED if it was not set
  197. assert default_config.workspace_mount_path is UndefinedString.UNDEFINED
  198. load_from_env(default_config, os.environ)
  199. assert os.environ.get('LLM_MODEL') is None
  200. assert default_config.get_llm_config().model == 'test-model'
  201. assert default_config.get_llm_config('llm').model == 'test-model'
  202. assert default_config.get_llm_config_from_agent().model == 'test-model'
  203. assert default_config.get_llm_config().api_key == 'env-api-key'
  204. # after we set workspace_base to 'UNDEFINED' in the environment,
  205. # workspace_base should be set to that
  206. # workspace_mount path is still UndefinedString.UNDEFINED
  207. assert default_config.workspace_base is not UndefinedString.UNDEFINED
  208. assert default_config.workspace_base == 'UNDEFINED'
  209. assert default_config.workspace_mount_path is UndefinedString.UNDEFINED
  210. assert default_config.workspace_mount_path == 'UNDEFINED'
  211. assert default_config.sandbox.box_type == 'e2b'
  212. assert default_config.disable_color is True
  213. assert default_config.sandbox.timeout == 1000
  214. assert default_config.sandbox.user_id == 1002
  215. finalize_config(default_config)
  216. # after finalize_config, workspace_mount_path is set to absolute path of workspace_base if it was undefined
  217. assert default_config.workspace_mount_path == os.getcwd() + '/UNDEFINED'
  218. def test_env_overrides_sandbox_toml(monkeypatch, default_config, temp_toml_file):
  219. # test that environment variables override TOML values using monkeypatch
  220. # uses a toml file with a sandbox section
  221. with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
  222. toml_file.write("""
  223. [llm]
  224. model = "test-model"
  225. api_key = "toml-api-key"
  226. [core]
  227. workspace_base = "/opt/files3/workspace"
  228. [sandbox]
  229. box_type = "e2b"
  230. timeout = 500
  231. user_id = 1001
  232. """)
  233. monkeypatch.setenv('LLM_API_KEY', 'env-api-key')
  234. monkeypatch.setenv('WORKSPACE_BASE', 'UNDEFINED')
  235. monkeypatch.setenv('SANDBOX_TYPE', 'local')
  236. monkeypatch.setenv('SANDBOX_TIMEOUT', '1000')
  237. monkeypatch.setenv('SANDBOX_USER_ID', '1002')
  238. load_from_toml(default_config, temp_toml_file)
  239. # before finalize_config, workspace_mount_path is UndefinedString.UNDEFINED if it was not set
  240. assert default_config.workspace_mount_path is UndefinedString.UNDEFINED
  241. # before load_from_env, values are set to the values from the toml file
  242. assert default_config.get_llm_config().api_key == 'toml-api-key'
  243. assert default_config.sandbox.box_type == 'e2b'
  244. assert default_config.sandbox.timeout == 500
  245. assert default_config.sandbox.user_id == 1001
  246. load_from_env(default_config, os.environ)
  247. # values from env override values from toml
  248. assert os.environ.get('LLM_MODEL') is None
  249. assert default_config.get_llm_config().model == 'test-model'
  250. assert default_config.get_llm_config().api_key == 'env-api-key'
  251. assert default_config.sandbox.box_type == 'local'
  252. assert default_config.sandbox.timeout == 1000
  253. assert default_config.sandbox.user_id == 1002
  254. finalize_config(default_config)
  255. # after finalize_config, workspace_mount_path is set to absolute path of workspace_base if it was undefined
  256. assert default_config.workspace_mount_path == os.getcwd() + '/UNDEFINED'
  257. def test_sandbox_config_from_toml(default_config, temp_toml_file):
  258. # Test loading configuration from a new-style TOML file
  259. with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
  260. toml_file.write(
  261. """
  262. [core]
  263. workspace_base = "/opt/files/workspace"
  264. [llm]
  265. model = "test-model"
  266. [sandbox]
  267. box_type = "local"
  268. timeout = 1
  269. container_image = "custom_image"
  270. user_id = 1001
  271. """
  272. )
  273. load_from_toml(default_config, temp_toml_file)
  274. load_from_env(default_config, os.environ)
  275. finalize_config(default_config)
  276. assert default_config.get_llm_config().model == 'test-model'
  277. assert default_config.sandbox.box_type == 'local'
  278. assert default_config.sandbox.timeout == 1
  279. assert default_config.sandbox.container_image == 'custom_image'
  280. assert default_config.sandbox.user_id == 1001
  281. def test_defaults_dict_after_updates(default_config):
  282. # Test that `defaults_dict` retains initial values after updates.
  283. initial_defaults = default_config.defaults_dict
  284. assert (
  285. initial_defaults['workspace_mount_path']['default'] is UndefinedString.UNDEFINED
  286. )
  287. assert initial_defaults['default_agent']['default'] == 'CodeActAgent'
  288. updated_config = AppConfig()
  289. updated_config.get_llm_config().api_key = 'updated-api-key'
  290. updated_config.get_llm_config('llm').api_key = 'updated-api-key'
  291. updated_config.get_llm_config_from_agent('agent').api_key = 'updated-api-key'
  292. updated_config.get_llm_config_from_agent('PlannerAgent').api_key = 'updated-api-key'
  293. updated_config.default_agent = 'PlannerAgent'
  294. defaults_after_updates = updated_config.defaults_dict
  295. assert defaults_after_updates['default_agent']['default'] == 'CodeActAgent'
  296. assert (
  297. defaults_after_updates['workspace_mount_path']['default']
  298. is UndefinedString.UNDEFINED
  299. )
  300. assert defaults_after_updates['sandbox']['box_type']['default'] == 'ssh'
  301. assert defaults_after_updates['sandbox']['timeout']['default'] == 120
  302. assert (
  303. defaults_after_updates['sandbox']['container_image']['default']
  304. == 'ghcr.io/opendevin/sandbox:main'
  305. )
  306. assert defaults_after_updates == initial_defaults
  307. def test_invalid_toml_format(monkeypatch, temp_toml_file, default_config):
  308. # Invalid TOML format doesn't break the configuration
  309. monkeypatch.setenv('LLM_MODEL', 'gpt-5-turbo-1106')
  310. monkeypatch.setenv('WORKSPACE_MOUNT_PATH', '/home/user/project')
  311. monkeypatch.delenv('LLM_API_KEY', raising=False)
  312. with open(temp_toml_file, 'w', encoding='utf-8') as toml_file:
  313. toml_file.write('INVALID TOML CONTENT')
  314. load_from_toml(default_config)
  315. load_from_env(default_config, os.environ)
  316. default_config.ssh_password = None # prevent leak
  317. default_config.jwt_secret = None # prevent leak
  318. for llm in default_config.llms.values():
  319. llm.api_key = None # prevent leak
  320. assert default_config.get_llm_config().model == 'gpt-5-turbo-1106'
  321. assert default_config.get_llm_config().custom_llm_provider is None
  322. assert default_config.workspace_mount_path == '/home/user/project'
  323. def test_finalize_config(default_config):
  324. # Test finalize config
  325. assert default_config.workspace_mount_path is UndefinedString.UNDEFINED
  326. default_config.sandbox.box_type = 'local'
  327. finalize_config(default_config)
  328. assert (
  329. default_config.workspace_mount_path_in_sandbox
  330. == default_config.workspace_mount_path
  331. )
  332. assert default_config.workspace_mount_path == os.path.abspath(
  333. default_config.workspace_base
  334. )
  335. # tests for workspace, mount path, path in sandbox, cache dir
  336. def test_workspace_mount_path_default(default_config):
  337. assert default_config.workspace_mount_path is UndefinedString.UNDEFINED
  338. finalize_config(default_config)
  339. assert default_config.workspace_mount_path == os.path.abspath(
  340. default_config.workspace_base
  341. )
  342. def test_workspace_mount_path_in_sandbox_local(default_config):
  343. assert default_config.workspace_mount_path_in_sandbox == '/workspace'
  344. default_config.sandbox.box_type = 'local'
  345. finalize_config(default_config)
  346. assert (
  347. default_config.workspace_mount_path_in_sandbox
  348. == default_config.workspace_mount_path
  349. )
  350. def test_workspace_mount_rewrite(default_config, monkeypatch):
  351. default_config.workspace_base = '/home/user/project'
  352. default_config.workspace_mount_rewrite = '/home/user:/sandbox'
  353. monkeypatch.setattr('os.getcwd', lambda: '/current/working/directory')
  354. finalize_config(default_config)
  355. assert default_config.workspace_mount_path == '/sandbox/project'
  356. def test_embedding_base_url_default(default_config):
  357. default_config.get_llm_config().base_url = 'https://api.exampleapi.com'
  358. finalize_config(default_config)
  359. assert (
  360. default_config.get_llm_config().embedding_base_url
  361. == 'https://api.exampleapi.com'
  362. )
  363. def test_cache_dir_creation(default_config, tmpdir):
  364. default_config.cache_dir = str(tmpdir.join('test_cache'))
  365. finalize_config(default_config)
  366. assert os.path.exists(default_config.cache_dir)
  367. def test_api_keys_repr_str():
  368. # Test LLMConfig
  369. llm_config = LLMConfig(
  370. api_key='my_api_key',
  371. aws_access_key_id='my_access_key',
  372. aws_secret_access_key='my_secret_key',
  373. )
  374. assert "api_key='******'" in repr(llm_config)
  375. assert "aws_access_key_id='******'" in repr(llm_config)
  376. assert "aws_secret_access_key='******'" in repr(llm_config)
  377. assert "api_key='******'" in str(llm_config)
  378. assert "aws_access_key_id='******'" in str(llm_config)
  379. assert "aws_secret_access_key='******'" in str(llm_config)
  380. # Check that no other attrs in LLMConfig have 'key' or 'token' in their name
  381. # This will fail when new attrs are added, and attract attention
  382. known_key_token_attrs_llm = [
  383. 'api_key',
  384. 'aws_access_key_id',
  385. 'aws_secret_access_key',
  386. 'input_cost_per_token',
  387. 'output_cost_per_token',
  388. ]
  389. for attr_name in dir(LLMConfig):
  390. if (
  391. not attr_name.startswith('__')
  392. and attr_name not in known_key_token_attrs_llm
  393. ):
  394. assert (
  395. 'key' not in attr_name.lower()
  396. ), f"Unexpected attribute '{attr_name}' contains 'key' in LLMConfig"
  397. assert (
  398. 'token' not in attr_name.lower() or 'tokens' in attr_name.lower()
  399. ), f"Unexpected attribute '{attr_name}' contains 'token' in LLMConfig"
  400. # Test AgentConfig
  401. # No attrs in AgentConfig have 'key' or 'token' in their name
  402. agent_config = AgentConfig(memory_enabled=True, memory_max_threads=4)
  403. for attr_name in dir(AgentConfig):
  404. if not attr_name.startswith('__'):
  405. assert (
  406. 'key' not in attr_name.lower()
  407. ), f"Unexpected attribute '{attr_name}' contains 'key' in AgentConfig"
  408. assert (
  409. 'token' not in attr_name.lower() or 'tokens' in attr_name.lower()
  410. ), f"Unexpected attribute '{attr_name}' contains 'token' in AgentConfig"
  411. # Test AppConfig
  412. app_config = AppConfig(
  413. llms={'llm': llm_config},
  414. agents={'agent': agent_config},
  415. e2b_api_key='my_e2b_api_key',
  416. jwt_secret='my_jwt_secret',
  417. ssh_password='my_ssh_password',
  418. )
  419. assert "e2b_api_key='******'" in repr(app_config)
  420. assert "e2b_api_key='******'" in str(app_config)
  421. assert "jwt_secret='******'" in repr(app_config)
  422. assert "jwt_secret='******'" in str(app_config)
  423. assert "ssh_password='******'" in repr(app_config)
  424. assert "ssh_password='******'" in str(app_config)
  425. # Check that no other attrs in AppConfig have 'key' or 'token' in their name
  426. # This will fail when new attrs are added, and attract attention
  427. known_key_token_attrs_app = ['e2b_api_key']
  428. for attr_name in dir(AppConfig):
  429. if (
  430. not attr_name.startswith('__')
  431. and attr_name not in known_key_token_attrs_app
  432. ):
  433. assert (
  434. 'key' not in attr_name.lower()
  435. ), f"Unexpected attribute '{attr_name}' contains 'key' in AppConfig"
  436. assert (
  437. 'token' not in attr_name.lower() or 'tokens' in attr_name.lower()
  438. ), f"Unexpected attribute '{attr_name}' contains 'token' in AppConfig"
  439. def test_max_iterations_and_max_budget_per_task_from_toml(temp_toml_file):
  440. temp_toml = """
  441. [core]
  442. max_iterations = 100
  443. max_budget_per_task = 4.0
  444. """
  445. config = AppConfig()
  446. with open(temp_toml_file, 'w') as f:
  447. f.write(temp_toml)
  448. load_from_toml(config, temp_toml_file)
  449. assert config.max_iterations == 100
  450. assert config.max_budget_per_task == 4.0
  451. def test_get_llm_config_arg(temp_toml_file):
  452. temp_toml = """
  453. [core]
  454. max_iterations = 100
  455. max_budget_per_task = 4.0
  456. [llm.gpt3]
  457. model="gpt-3.5-turbo"
  458. api_key="redacted"
  459. embedding_model="openai"
  460. [llm.gpt4o]
  461. model="gpt-4o"
  462. api_key="redacted"
  463. embedding_model="openai"
  464. """
  465. with open(temp_toml_file, 'w') as f:
  466. f.write(temp_toml)
  467. llm_config = get_llm_config_arg('gpt3', temp_toml_file)
  468. assert llm_config.model == 'gpt-3.5-turbo'
  469. assert llm_config.embedding_model == 'openai'