From cee2cefb6f415499a916d75e034806f9fa9ebefd Mon Sep 17 00:00:00 2001 From: Pierce Kelaita Date: Mon, 30 Sep 2024 11:02:01 -0700 Subject: [PATCH] [models] remove provider octoAI --- l2m2/client/base_llm_client.py | 32 ------- l2m2/model_info.py | 107 ---------------------- tests/l2m2/client/test_base_llm_client.py | 11 --- 3 files changed, 150 deletions(-) diff --git a/l2m2/client/base_llm_client.py b/l2m2/client/base_llm_client.py index 7a25727..be0bbf7 100644 --- a/l2m2/client/base_llm_client.py +++ b/l2m2/client/base_llm_client.py @@ -35,7 +35,6 @@ "google": "GOOGLE_API_KEY", "groq": "GROQ_API_KEY", "replicate": "REPLICATE_API_TOKEN", - "octoai": "OCTOAI_TOKEN", "mistral": "MISTRAL_API_KEY", } @@ -669,37 +668,6 @@ async def _call_replicate( ) return "".join(result["output"]) - async def _call_octoai( - self, - model_id: str, - prompt: str, - system_prompt: Optional[str], - params: Dict[str, Any], - timeout: Optional[int], - memory: Optional[BaseMemory], - json_mode: bool, - json_mode_strategy: JsonModeStrategy, - _: Dict[str, Any], # TODO refactor - ) -> str: - if isinstance(memory, ChatMemory) and model_id == "mixtral-8x22b-instruct": - raise LLMOperationError( - "Chat memory is not supported with mixtral-8x22b via OctoAI. Try using" - + " ExternalMemory instead, or ChatMemory with a different model/provider." - ) - - return await self._generic_openai_spec_call( - "octoai", - model_id, - prompt, - system_prompt, - params, - timeout, - memory, - json_mode, - json_mode_strategy, - {}, - ) - async def _generic_openai_spec_call( self, provider: str, diff --git a/l2m2/model_info.py b/l2m2/model_info.py index 65a50be..e962d05 100644 --- a/l2m2/model_info.py +++ b/l2m2/model_info.py @@ -111,15 +111,6 @@ class ModelEntry(TypedDict): "Content-Type": "application/json", }, }, - "octoai": { - "name": "OctoAI", - "homepage": "https://octoai.cloud/", - "endpoint": "https://text.octoai.run/v1/chat/completions", - "headers": { - "Authorization": f"Bearer {API_KEY}", - "Content-Type": "application/json", - }, - }, } MODEL_INFO: Dict[str, Dict[str, ModelEntry]] = { @@ -350,20 +341,6 @@ class ModelEntry(TypedDict): }, "extras": {"json_mode_arg": {"response_format": {"type": "json_object"}}}, }, - "octoai": { - "model_id": "mixtral-8x22b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, }, "mixtral-8x7b": { "mistral": { @@ -380,20 +357,6 @@ class ModelEntry(TypedDict): }, "extras": {"json_mode_arg": {"response_format": {"type": "json_object"}}}, }, - "octoai": { - "model_id": "mixtral-8x7b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, "groq": { "model_id": "mixtral-8x7b-32768", "params": { @@ -424,20 +387,6 @@ class ModelEntry(TypedDict): }, "extras": {"json_mode_arg": {"response_format": {"type": "json_object"}}}, }, - "octoai": { - "model_id": "mistral-7b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, }, "gemma-7b": { "groq": { @@ -532,36 +481,8 @@ class ModelEntry(TypedDict): }, "extras": {}, }, - "octoai": { - "model_id": "meta-llama-3-70b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, }, "llama-3.1-8b": { - "octoai": { - "model_id": "meta-llama-3.1-8b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, "groq": { "model_id": "llama-3.1-8b-instant", "params": { @@ -578,20 +499,6 @@ class ModelEntry(TypedDict): }, }, "llama-3.1-70b": { - "octoai": { - "model_id": "meta-llama-3.1-70b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, "groq": { "model_id": "llama-3.1-70b-versatile", "params": { @@ -623,20 +530,6 @@ class ModelEntry(TypedDict): }, "extras": {}, }, - "octoai": { - "model_id": "meta-llama-3.1-405b-instruct", - "params": { - "temperature": { - "default": PROVIDER_DEFAULT, - "max": 2.0, - }, - "max_tokens": { - "default": PROVIDER_DEFAULT, - "max": INF, - }, - }, - "extras": {}, - }, }, "llama-3.2-1b": { "groq": { diff --git a/tests/l2m2/client/test_base_llm_client.py b/tests/l2m2/client/test_base_llm_client.py index b7505d1..db52ae0 100644 --- a/tests/l2m2/client/test_base_llm_client.py +++ b/tests/l2m2/client/test_base_llm_client.py @@ -17,7 +17,6 @@ # Model/provider pairs which don't support ChatMemory CHAT_MEMORY_UNSUPPORTED_MODELS = { - "octoai": "mixtral-8x22b", "replicate": "llama-3-8b", # Applies to all models via Replicate } @@ -328,16 +327,6 @@ async def test_call_replicate(mock_get_extra_message, mock_llm_post, llm_client) await _generic_test_call(llm_client, "replicate", "llama-3-8b") -@pytest.mark.asyncio -@patch(LLM_POST_PATH) -@patch(GET_EXTRA_MESSAGE_PATH) -async def test_call_octoai(mock_get_extra_message, mock_llm_post, llm_client): - mock_get_extra_message.return_value = "extra message" - mock_return_value = {"choices": [{"message": {"content": "response"}}]} - mock_llm_post.return_value = mock_return_value - await _generic_test_call(llm_client, "octoai", "llama-3.1-405b") - - @pytest.mark.asyncio @patch(LLM_POST_PATH) async def test_call_google_gemini_fails(mock_llm_post, llm_client):