Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vojay-dev committed May 18, 2024
1 parent 44d1d47 commit 3073f97
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arctic_query_quest/arctic.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import json
import logging
import re
from functools import wraps
from time import sleep
import logging

from langchain_community.llms.replicate import Replicate
from pydantic import BaseModel

from arctic_query_quest.common import console_log

logger = logging.getLogger(__name__)

SYSTEM_PROMPT = """
Expand Down Expand Up @@ -87,7 +85,7 @@ def _extract_json(text: str) -> str:

def _parse_output(self, text: str) -> ArcticQuiz:
json_text = self._extract_json(text)
return ArcticQuiz.parse_obj(json.loads(json_text.lstrip().rstrip()))
return ArcticQuiz.model_validate(json.loads(json_text.lstrip().rstrip()))

@retry(max_retries=8)
def invoke(self, prompt: str) -> ArcticQuiz:
Expand All @@ -96,5 +94,4 @@ def invoke(self, prompt: str) -> ArcticQuiz:
chunks.append(chunk)

output = "".join(chunks)
console_log(f"LLM output: {output}")
return self._parse_output(output)

0 comments on commit 3073f97

Please sign in to comment.