Skip to content

Commit 8f86ce6

Browse files
authored
chore: clean up naming (#126)
1 parent 5c6cefd commit 8f86ce6

File tree

23 files changed

+62
-67
lines changed

23 files changed

+62
-67
lines changed

src/any_llm/provider.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,11 @@ def get_provider_metadata(cls) -> dict[str, str | bool]:
148148
}
149149

150150
@abstractmethod
151-
def _make_api_call(
152-
self, model: str, messages: list[dict[str, Any]], **kwargs: Any
151+
def completion(
152+
self,
153+
model: str,
154+
messages: list[dict[str, Any]],
155+
**kwargs: Any,
153156
) -> ChatCompletion | Iterator[ChatCompletionChunk]:
154157
"""This method is designed to make the API call to the provider.
155158
@@ -164,14 +167,6 @@ def _make_api_call(
164167
msg = "Subclasses must implement this method"
165168
raise NotImplementedError(msg)
166169

167-
def completion(
168-
self,
169-
model: str,
170-
messages: list[dict[str, Any]],
171-
**kwargs: Any,
172-
) -> ChatCompletion | Iterator[ChatCompletionChunk]:
173-
return self._make_api_call(model, messages, **kwargs)
174-
175170
async def acompletion(
176171
self,
177172
model: str,

src/any_llm/providers/anthropic/anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _stream_completion(
6262
for event in anthropic_stream:
6363
yield _create_openai_chunk_from_anthropic_chunk(event)
6464

65-
def _make_api_call(
65+
def completion(
6666
self,
6767
model: str,
6868
messages: list[dict[str, Any]],

src/any_llm/providers/aws/aws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _check_aws_credentials(self) -> None:
5252
if credentials is None and bedrock_api_key is None:
5353
raise MissingApiKeyError(provider_name=self.PROVIDER_NAME, env_var_name=self.ENV_API_KEY_NAME)
5454

55-
def _make_api_call(
55+
def completion(
5656
self,
5757
model: str,
5858
messages: list[dict[str, Any]],

src/any_llm/providers/azure/azure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _stream_completion(
8484
for chunk in azure_stream:
8585
yield _create_openai_chunk_from_azure_chunk(chunk)
8686

87-
def _make_api_call(
87+
def completion(
8888
self,
8989
model: str,
9090
messages: list[dict[str, Any]],

src/any_llm/providers/cerebras/cerebras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _stream_completion(
6161
msg = f"Unsupported chunk type: {type(chunk)}"
6262
raise ValueError(msg)
6363

64-
def _make_api_call(
64+
def completion(
6565
self,
6666
model: str,
6767
messages: list[dict[str, Any]],

src/any_llm/providers/cohere/cohere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _stream_completion(
5050
for chunk in cohere_stream:
5151
yield _create_openai_chunk_from_cohere_chunk(chunk)
5252

53-
def _make_api_call(
53+
def completion(
5454
self,
5555
model: str,
5656
messages: list[dict[str, Any]],

src/any_llm/providers/deepseek/deepseek.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DeepseekProvider(BaseOpenAIProvider):
1616

1717
SUPPORTS_EMBEDDING = False # DeepSeek doesn't host an embedding model
1818

19-
def _make_api_call(
19+
def completion(
2020
self,
2121
model: str,
2222
messages: list[dict[str, Any]],
@@ -29,4 +29,4 @@ def _make_api_call(
2929
kwargs["response_format"] = {"type": "json_object"}
3030
messages = modified_messages
3131

32-
return super()._make_api_call(model, messages, **kwargs)
32+
return super().completion(model, messages, **kwargs)

src/any_llm/providers/fireworks/fireworks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _stream_completion(
4040
for chunk in response_generator:
4141
yield _create_openai_chunk_from_fireworks_chunk(chunk)
4242

43-
def _make_api_call(
43+
def completion(
4444
self,
4545
model: str,
4646
messages: list[dict[str, Any]],

src/any_llm/providers/google/google.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def embedding(
8282

8383
return _create_openai_embedding_response_from_google(model, result)
8484

85-
def _make_api_call(
85+
def completion(
8686
self,
8787
model: str,
8888
messages: list[dict[str, Any]],

src/any_llm/providers/groq/groq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _stream_completion(
5959
for chunk in stream:
6060
yield _create_openai_chunk_from_groq_chunk(chunk)
6161

62-
def _make_api_call(
62+
def completion(
6363
self,
6464
model: str,
6565
messages: list[dict[str, Any]],

0 commit comments

Comments
 (0)