Skip to content

Commit

Permalink
dev: log mistral fc
Browse files Browse the repository at this point in the history
  • Loading branch information
zhudotexe committed Oct 2, 2024
1 parent 9b4e3bd commit 3bd0a18
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kani/prompts/impl/mistral.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import json
import logging
import re

from kani.ai_function import AIFunction
from kani.engines import Completion, WrapperEngine
from kani.models import ChatMessage, ChatRole, FunctionCall, ToolCall
from kani.prompts import ApplyContext, PromptPipeline

log = logging.getLogger(__name__)


# ref: https://github.com/mistralai/mistral-common/blob/main/src/mistral_common/tokens/tokenizers/sentencepiece.py
def maybe_json(content: str):
Expand Down Expand Up @@ -199,6 +202,7 @@ def _parse_tool_calls(self, content: str) -> tuple[str, list[ToolCall]]:
)
if tool_json is None:
return content, []
log.debug(f"Found tool JSON while parsing: {tool_json.group(1)}")
actions = json.loads(tool_json.group(1))

# translate back to kani spec
Expand Down

0 comments on commit 3bd0a18

Please sign in to comment.