Skip to content

Commit

Permalink
update GitHub workflow yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Asher-hss committed Feb 3, 2025
1 parent 30c61ae commit 41cb39c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"
JINA_API_KEY: "${{ secrets.JINA_API_KEY }}"
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
run: |
source venv/bin/activate
pytest --fast-test-mode ./test
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pytest_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
SEARCH_ENGINE_ID: "${{ secrets.SEARCH_ENGINE_ID }}"
COHERE_API_KEY: "${{ secrets.COHERE_API_KEY }}"
INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
run: poetry run pytest -v apps/

pytest_examples:
Expand All @@ -49,4 +50,5 @@ jobs:
SEARCH_ENGINE_ID: "${{ secrets.SEARCH_ENGINE_ID }}"
COHERE_API_KEY: "${{ secrets.COHERE_API_KEY }}"
INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
run: poetry run pytest -v examples/
2 changes: 2 additions & 0 deletions .github/workflows/pytest_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"
JINA_API_KEY: "${{ secrets.JINA_API_KEY }}"
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
run: poetry run pytest --fast-test-mode test/

pytest_package_llm_test:
Expand Down Expand Up @@ -107,6 +108,7 @@ jobs:
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"
JINA_API_KEY: "${{ secrets.JINA_API_KEY }}"
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
run: poetry run pytest --llm-test-only test/

pytest_package_very_slow_test:
Expand Down
17 changes: 9 additions & 8 deletions camel/models/siliconflow_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,23 @@


class SiliconFlowModel(BaseModelBackend):
"""SiliconFlow API in a unified BaseModelBackend interface.
r"""SiliconFlow API in a unified BaseModelBackend interface.
Args:
model_type (Union[ModelType, str]): Model for which a backend is
created, one of SiliconFlow series.
created.
model_config_dict (Optional[Dict[str, Any]], optional): A dictionary
that will be fed into OpenAI client. If :obj:`None`,
:obj:`SiliconFlowConfig().as_dict()` will be used.
(default: :obj:`None`)
api_key (Optional[str], optional): The API key for authenticating with
the SiliconFlow service. (default: :obj:`None`)
url (Optional[str], optional): The url to the SiliconFlow service.
(default: :obj:`https://api.siliconflow.cn/v1/`)
url (Optional[str], optional): The URL to the SiliconFlow service. If not
provided, :obj:`https://api.siliconflow.cn/v1/` will be used.
(default: :obj:`None`)
token_counter (Optional[BaseTokenCounter], optional): Token counter to
use for the model. If not provided, :obj:`OpenAITokenCounter(
ModelType.GPT_4)` will be used.
ModelType.GPT_4O_MINI)` will be used.
(default: :obj:`None`)
"""

Expand Down Expand Up @@ -85,7 +86,7 @@ def run(
self,
messages: List[OpenAIMessage],
) -> Union[ChatCompletion, Stream[ChatCompletionChunk]]:
"""Runs inference of SiliconFlow chat completion.
r"""Runs inference of SiliconFlow chat completion.
Args:
messages (List[OpenAIMessage]): Message list with the chat history
Expand All @@ -105,7 +106,7 @@ def run(

@property
def token_counter(self) -> BaseTokenCounter:
"""Initialize the token counter for the model backend.
r"""Initialize the token counter for the model backend.
Returns:
BaseTokenCounter: The token counter following the model's
Expand All @@ -116,7 +117,7 @@ def token_counter(self) -> BaseTokenCounter:
return self._token_counter

def check_model_config(self):
"""Check whether the model configuration contains any
r"""Check whether the model configuration contains any
unexpected arguments to SiliconFlow API.
Raises:
Expand Down

0 comments on commit 41cb39c

Please sign in to comment.