Skip to content

Commit

Permalink
[chore] convert response to JSON not string
Browse files Browse the repository at this point in the history
  • Loading branch information
yashbonde committed Oct 10, 2023
1 parent f42ad56 commit 82ba3dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cf_internal
7 changes: 3 additions & 4 deletions server/chainfury_server/api/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Annotated, Any, Tuple, Dict
from pydantic import BaseModel
from sqlalchemy.orm import Session
from dataclasses import dataclass
from dataclasses import dataclass, asdict

from chainfury_server.schemas.prompt_schema import PromptBody
from chainfury_server.commons.utils import get_user_from_jwt, verify_user
Expand Down Expand Up @@ -101,9 +101,8 @@ def _get_streaming_response(result):
content=_get_streaming_response(result),
)
else:
out = result.__dict__
out.pop("prompt")
return out
# out = result.__dict__
return result.to_dict()


class InternalFeedbackModel(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion server/chainfury_server/engines/fury.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import time
import json
import traceback
from pprint import pprint, pformat
from functools import partial
Expand Down Expand Up @@ -34,7 +35,7 @@ def run(self, chatbot: ChatBot, prompt: PromptBody, db: Session, start: float) -
callback = FuryThoughts(db, prompt_row.id)
mainline_out, full_ir = chain(prompt.new_message, thoughts_callback=callback, print_thoughts=False)
result = CFPromptResult(
result=str(mainline_out),
result=json.dumps(mainline_out),
thought=[{"engine": "fury", "ir_steps": callback.count, "thoughts": list(full_ir.keys())}],
num_tokens=1,
prompt=prompt_row,
Expand Down

0 comments on commit 82ba3dc

Please sign in to comment.