Skip to content

Commit

Permalink
rename Completion to ChatCompletion for correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
1b5d committed Oct 25, 2023
1 parent 3f21683 commit 2036c4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LLM API for python

This python library connects to (llm-api)[https://github.com/1b5d/llm-api] using python, it was build to mimic (OpenAI's python library)[https://github.com/openai/openai-python]
This python library connects to [llm-api](https://github.com/1b5d/llm-api) using python, it was build to mimic [OpenAI's python library](https://github.com/openai/openai-python)

# Usage

Expand All @@ -10,31 +10,31 @@ You can install this library using pip
pip install llm-api-python
```

After running (llm-api)[https://github.com/1b5d/llm-api], simply configure your client as if it's OpenAI's python binding
After running [llm-api](https://github.com/1b5d/llm-api), simply configure your client as if it's OpenAI's python binding

```python
import llm_api

llm_api.api_key = "<your llm-api api key here>"

completion = llm_api.Completion.create(messages=[
completion = llm_api.ChatCompletion.create(messages=[
{
"role": "system",
"content": "You are a helpful assistant, please answer the users' questions with honesty and accuracy."
}, {
"role": "user", "content": "What is the capital of France?"
}
]) # returns a completion object
]) # returns a chat completion object

completion = llm_api.Completion.create(messages=[
completion = llm_api.ChatCompletion.create(messages=[
...
], stream=True) # returns a generator

completion = await llm_api.Completion.acreate(messages=[
completion = await llm_api.ChatCompletion.acreate(messages=[
...
]) # returns a completion object
]) # returns a chat completion object

completion = await llm_api.Completion.acreate(messages=[
completion = await llm_api.ChatCompletion.acreate(messages=[
...
], stream=True) # returns a async generator

Expand Down
4 changes: 2 additions & 2 deletions llm_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import requests
from aiohttp import ClientSession

from llm_api.completion import Completion
from llm_api.completion import ChatCompletion
from llm_api.error import APIError, InvalidRequestError, LlmApiError # noqa: F401

__all__ = ["Completion"]
__all__ = ["ChatCompletion"]

api_key = os.environ.get("LLM_API_API_KEY")
api_key_path: Optional[str] = os.environ.get("LLM_API_API_KEY_PATH")
Expand Down
2 changes: 1 addition & 1 deletion llm_api/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DEFAULT_PROMPT = "You are a helpful assistant."


class Completion(ApiObject):
class ChatCompletion(ApiObject):
"""A wrapper for LLM API client completion."""

@classmethod
Expand Down

0 comments on commit 2036c4f

Please sign in to comment.