Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP draft of generate() outside of chat.answer() #432

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
get default system_prompt strings on each generate call
  • Loading branch information
dillonroach committed Sep 5, 2024
commit 2e8ae2cf5ad0fb0d653f163d4dfc92e8b97fc28d
2 changes: 1 addition & 1 deletion ragna/assistants/_ai21labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def _render_prompt(self, prompt: Union[str, list[Message]]) -> Union[str, list]:
async def generate(
self,
prompt: Union[str, list[Message]],
system_prompt: str,
*,
system_prompt: str = "You are a helpful assistant.",
max_new_tokens: int = 256,
) -> AsyncIterator[str]:
"""
Expand Down
2 changes: 1 addition & 1 deletion ragna/assistants/_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def _render_prompt(self, prompt: Union[str, list[Message]]) -> list[dict]:
async def generate(
self,
prompt: Union[str, list[Message]],
system_prompt: str,
*,
system_prompt: str = "You are a helpful assistant.",
max_new_tokens: int = 256,
) -> AsyncIterator[str]:
"""
Expand Down
2 changes: 1 addition & 1 deletion ragna/assistants/_cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def _render_prompt(self, prompt: Union[str, list[Message]]) -> str:
async def generate(
self,
prompt: Union[str, list[Message]],
system_prompt: str,
source_documents: list[dict[str, str]],
*,
system_prompt: str = "You are a helpful assistant.",
max_new_tokens: int = 256,
) -> AsyncIterator[str]:
"""
Expand Down
2 changes: 1 addition & 1 deletion ragna/assistants/_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _render_prompt(self, prompt: Union[str,list[Message]], system_prompt: str) -
return system_message.extend(messages)

async def generate(
self, prompt: Union[str,list[Message]], system_prompt: str, *, max_new_tokens: int = 256
self, prompt: Union[str,list[Message]], *, system_prompt: str = "You are a helpful assistant.", max_new_tokens: int = 256
) -> AsyncIterator[dict[str, Any]]:
"""
Primary method for calling assistant inference, either as a one-off request from anywhere in ragna, or as part of self.answer()
Expand Down