This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add back sciphi * cleanup scripts * expand scripts
- Loading branch information
1 parent
2cc8a35
commit a97c6f4
Showing
16 changed files
with
554 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ authors = ["Owen Colegrove <[email protected]>"] | |
license = "Apache-2.0" | ||
readme = "README.md" | ||
name = 'sciphi-synthesizer' | ||
version = '1.0.0' | ||
version = '1.0.1' | ||
packages = [ | ||
{ include = "synthesizer" } | ||
] | ||
|
@@ -24,7 +24,6 @@ fire = "^0.5.0" | |
openai = { version = "0.27.8" } | ||
pyyaml = "^6.0.1" | ||
retrying = "^1.3.4" | ||
tqdm = "^4.66.1" | ||
|
||
# Begin optional dependencies | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""A module for interfacing with the SciPhi API""" | ||
import logging | ||
|
||
from synthesizer.interface.base import LLMInterface, LLMProviderName | ||
from synthesizer.interface.llm_interface_manager import llm_interface | ||
from synthesizer.llm import GenerationConfig, SciPhiConfig, SciPhiLLM | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@llm_interface | ||
class SciPhiLLMInterface(LLMInterface): | ||
"""A class to interface with the SciPhi API.""" | ||
|
||
provider_name = LLMProviderName.SCIPHI | ||
system_message = "You are a helpful assistant." | ||
|
||
def __init__( | ||
self, | ||
config: SciPhiConfig, | ||
*args, | ||
**kwargs, | ||
) -> None: | ||
self.config = config | ||
self._model = SciPhiLLM(config) | ||
|
||
def get_completion( | ||
self, prompt: str, generation_config: GenerationConfig | ||
) -> str: | ||
"""Get a completion from the SciPhi API based on the provided prompt.""" | ||
|
||
logger.debug( | ||
f"Getting completion from SciPhi API for model={generation_config.model_name}" | ||
) | ||
if "instruct" in generation_config.model_name: | ||
return self.model.get_instruct_completion( | ||
prompt, generation_config | ||
) | ||
else: | ||
return self._model.get_chat_completion( | ||
[ | ||
{ | ||
"role": "system", | ||
"content": SciPhiLLMInterface.system_message, | ||
}, | ||
{"role": "user", "content": prompt}, | ||
], | ||
generation_config, | ||
) | ||
|
||
def get_chat_completion( | ||
self, conversation: list[dict], generation_config: GenerationConfig | ||
) -> str: | ||
raise NotImplementedError( | ||
"Chat completion not yet implemented for SciPhi." | ||
) | ||
|
||
@property | ||
def model(self) -> SciPhiLLM: | ||
return self._model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.