diff --git a/contracts/contracts/GroqChatGpt.sol b/contracts/contracts/GroqChatGpt.sol index dd89111..ccac9db 100644 --- a/contracts/contracts/GroqChatGpt.sol +++ b/contracts/contracts/GroqChatGpt.sol @@ -41,7 +41,7 @@ contract GroqChatGpt { chatRunsCount = 0; config = IOracle.GroqRequest({ - model : "mixtral-8x7b-32768", + model : "llama-3.1-8b-instant", frequencyPenalty : 21, // > 20 for null logitBias : "", // empty str for null maxTokens : 1000, // 0 for null diff --git a/contracts/package.json b/contracts/package.json index 7f3a4fd..07d05df 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -7,7 +7,6 @@ "node": "npx hardhat node", "compile": "npx hardhat compile", "test": "npx hardhat test", - "whitelist": "npx hardhat run scripts/whitelist.ts --network galadriel", "deployAll:localhost": "npx hardhat run scripts/deployAll.ts --network localhost", "deployAll:galadriel": "npx hardhat run scripts/deployAll.ts --network galadriel", "deployQuickstart": "npx hardhat run scripts/deployQuickstart.ts --network galadriel", diff --git a/contracts/tasks/whitelist.ts b/contracts/tasks/whitelist.ts index 8573838..70585dc 100644 --- a/contracts/tasks/whitelist.ts +++ b/contracts/tasks/whitelist.ts @@ -1,12 +1,11 @@ import { task } from "hardhat/config"; -// Define the task with the name 'whitelist-address' -export const whitelistTask = task("whitelist", "Whitelists an address in the Oracle contract") - .addParam("oracleAddress", "The address of the Oracle contract") - .addParam("whitelistAddress", "The address to whitelist") +task("whitelist", "Whitelists an address in the Oracle contract") + .addParam("oracleaddress", "The address of the Oracle contract") + .addParam("whitelistaddress", "The address to whitelist") .setAction(async (taskArgs, hre) => { - const oracleContractAddress = taskArgs.oracleAddress; - const whitelistAddress = taskArgs.whitelistAddress; + const oracleContractAddress = taskArgs.oracleaddress; + const whitelistAddress = taskArgs.whitelistaddress; const pcr0Hash = "5c8ce02f8c739a6578886ef009dc27dc69ac85a631689b093f75f6ae238e10d70a08dce8f0cafdd1f7d9b3a26c889565"; const contractABI = [ diff --git a/oracles/src/domain/llm/groq_llm.py b/oracles/src/domain/llm/groq_llm.py index 3c1361d..2cbe25d 100644 --- a/oracles/src/domain/llm/groq_llm.py +++ b/oracles/src/domain/llm/groq_llm.py @@ -1,15 +1,14 @@ -import backoff from typing import Optional +import backoff import groq from groq import AsyncGroq -from openai.types.chat import ChatCompletion -from openai.types.chat.chat_completion import ChatCompletion from groq.types.chat import ChatCompletion as GroqChatCompletion +from openai.types.chat.chat_completion import ChatCompletion -from src.entities import Chat -from src.domain.llm.utils import TIMEOUT import settings +from src.domain.llm.utils import TIMEOUT +from src.entities import Chat @backoff.on_exception( @@ -20,6 +19,9 @@ async def execute(chat: Chat) -> Optional[GroqChatCompletion]: api_key=settings.GROQ_API_KEY, timeout=TIMEOUT, ) + for message in chat.messages: + if len(message.get("content")) and message.get("content")[0].get("text"): + message["content"] = message.get("content")[0].get("text") chat_completion: ChatCompletion = await client.chat.completions.create( messages=chat.messages, model=chat.config.model, diff --git a/oracles/src/entities.py b/oracles/src/entities.py index 08bc8fc..fa62d63 100644 --- a/oracles/src/entities.py +++ b/oracles/src/entities.py @@ -14,7 +14,12 @@ "gpt-4o", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-3.5-turbo-1106" ] GroqModelType = Literal[ - "llama3-8b-8192", "llama3-70b-8192", "mixtral-8x7b-32768", "gemma-7b-it" + "llama-3.1-70b-versatile", + "llama-3.1-8b-instant", + "llama3-70b-8192", + "llama3-8b-8192", + "mixtral-8x7b-32768", + "gemma-7b-it", ] AnthropicModelType = Literal[ "claude-3-5-sonnet-20240620",