Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
fix: fix validation errors for cohere response
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoubmrx committed Mar 25, 2024
1 parent e8a44d2 commit 39e8b94
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions hyko_toolkit/apis/cohere/chat/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

import httpx
from hyko_sdk.models import CoreModel, Method
from pydantic import Field
Expand Down Expand Up @@ -41,14 +39,13 @@ class Outputs(CoreModel):


class ChatHistoryItem(CoreModel):
message: str
response_id: str
generation_id: str
role: str
message: str


class CohereResponse(CoreModel):
chat_history: List[ChatHistoryItem]
text: str
chat_history: list[ChatHistoryItem]


@func.on_call
Expand All @@ -63,7 +60,9 @@ async def call(inputs: Inputs, params: Params):
"Authorization": f"bearer {params.user_access_token}",
},
json={
"chat_history": [{"role": "SYSTEM", "message": inputs.system_prompt}],
"chat_history": [
{"role": "SYSTEM", "message": inputs.system_prompt},
],
"model": "command",
"message": inputs.prompt,
"temperature": params.temperature,
Expand Down

0 comments on commit 39e8b94

Please sign in to comment.