Skip to content

Commit

Permalink
fix: claude prompts do not need to start with user anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
zhudotexe committed Nov 13, 2024
1 parent b2d11a7 commit bd11952
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kani/engines/anthropic/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def content_transform(msg: ChatMessage):
.merge_consecutive(role=ChatRole.USER, sep="\n")
.merge_consecutive(role=ChatRole.ASSISTANT, sep=" ")
.ensure_bound_function_calls()
.ensure_start(role=ChatRole.USER)
.conversation_dict(function_role="user", content_transform=content_transform)
)

Expand Down Expand Up @@ -283,6 +282,7 @@ async def predict(
kwargs, prompt_msgs = self._prepare_request(messages, functions)

# --- completion ---
assert len(prompt_msgs) > 0
message = await self.client.messages.create(
model=self.model,
max_tokens=self.max_tokens,
Expand All @@ -301,6 +301,7 @@ async def stream(
# do the stream
kwargs, prompt_msgs = self._prepare_request(messages, functions)

assert len(prompt_msgs) > 0
async with self.client.messages.stream(
model=self.model,
max_tokens=self.max_tokens,
Expand Down

0 comments on commit bd11952

Please sign in to comment.