Skip to content

Commit

Permalink
Fix issues with PR MorpheusAIs#34
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffordattractor committed Jul 16, 2024
1 parent 2d9ae15 commit 350392b
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 13 deletions.
2 changes: 1 addition & 1 deletion submodules/moragents_dockers/agents/Dockerfile-apple
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/arm64 python:3.10-bullseye
FROM arm64v8/python:3.10-bullseye

# Set the working directory in the container
WORKDIR /app
Expand Down
6 changes: 1 addition & 5 deletions submodules/moragents_dockers/agents/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ scikit-learn
huggingface-hub
flask==2.2.2
Werkzeug==2.2.2
gradio
flask-cors
web3
pytest
pytest-flask
pytest-mock
pymupdf==1.22.5
faiss-cpu
langchain-text-splitters
langchain-core
langchain-community
langchain-community
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from flask import Flask, request, jsonify
from flask_cors import CORS
import requests
import tools
from data_agent_config import Config
from data_agent.src import tools
from config import Config
import json


Expand Down Expand Up @@ -53,7 +53,7 @@ def chat(request,llm):
if 'prompt' in data:
prompt = data['prompt']
response,role = generate_response(prompt,llm)
return jsonify({"role":role,"content":response}), 200
return jsonify({"role":role,"content":response})
else:
return jsonify({"error": "Missing required parameters"}), 400

Expand Down
27 changes: 27 additions & 0 deletions submodules/moragents_dockers/agents/src/data_agent/src/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import logging

# Logging configuration
logging.basicConfig(level=logging.INFO)

# Configuration object
class Config:
# Model configuration
MODEL_NAME = "meetkai/functionary-small-v2.4-GGUF"
MODEL_REVISION = "functionary-small-v2.4.Q4_0.gguf"
MODEL_PATH = "model/"+MODEL_REVISION
DOWNLOAD_DIR = "model"
# API endpoints
COINGECKO_BASE_URL = "https://api.coingecko.com/api/v3"
DEFILLAMA_BASE_URL = "https://api.llama.fi"
PRICE_SUCCESS_MESSAGE = "The price of {coin_name} is ${price:,}"
PRICE_FAILURE_MESSAGE = "Failed to retrieve price. Please enter a valid coin name."
FLOOR_PRICE_SUCCESS_MESSAGE = "The floor price of {nft_name} is ${floor_price:,}"
FLOOR_PRICE_FAILURE_MESSAGE = "Failed to retrieve floor price. Please enter a valid NFT name."
TVL_SUCCESS_MESSAGE = "The TVL of {protocol_name} is ${tvl:,}"
TVL_FAILURE_MESSAGE = "Failed to retrieve TVL. Please enter a valid protocol name."
FDV_SUCCESS_MESSAGE = "The fully diluted valuation of {coin_name} is ${fdv:,}"
FDV_FAILURE_MESSAGE = "Failed to retrieve FDV. Please enter a valid coin name."
MARKET_CAP_SUCCESS_MESSAGE = "The market cap of {coin_name} is ${market_cap:,}"
MARKET_CAP_FAILURE_MESSAGE = "Failed to retrieve market cap. Please enter a valid coin name."
API_ERROR_MESSAGE = "I can't seem to access the API at the moment."

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import requests
import logging
from data_agent_config import Config
from config import Config
import time
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from llama_cpp import Llama
from llama_cpp.llama_tokenizer import LlamaHFTokenizer
import requests
from . import tools
from swap_agent_config import Config
from swap_agent.src import tools
from swap_agent.src.tools import InsufficientFundsError, TokenNotFoundError, SwapNotPossibleError
from config import Config
import json


Expand Down
25 changes: 25 additions & 0 deletions submodules/moragents_dockers/agents/src/swap_agent/src/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import logging

# Logging configuration
logging.basicConfig(level=logging.INFO)

# Configuration object
class Config:
# Model configuration
MODEL_NAME = "meetkai/functionary-small-v2.4-GGUF"
MODEL_REVISION = "functionary-small-v2.4.Q4_0.gguf"
MODEL_PATH = "model/"+MODEL_REVISION
DOWNLOAD_DIR = "model"
# API endpoints
INCH_URL = "https://api.1inch.dev/token"
QUOTE_URL = "https://api.1inch.dev/swap"
APIBASEURL = f"https://api.1inch.dev/swap/v6.0/"
HEADERS = { "Authorization": "Bearer WvQuxaMYpPvDiiOL5RHWUm7OzOd20nt4", "accept": "application/json" }
WEB3RPCURL = {"56":"https://bsc-dataseed.binance.org","42161":"https://arb1.arbitrum.io/rpc","137":"https://polygon-rpc.com","1":"https://cloudflare-eth.com","10":"https://mainnet.optimism.io","8453":"https://mainnet.base.org"}
NATIVE_TOKENS={"137":"MATIC","56":"BNB","1":"ETH","42161":"ETH","10":"ETH","8453":"ETH"}
ERC20_ABI = [
{"constant": True, "inputs": [], "name": "decimals", "outputs": [{"name": "", "type": "uint8"}], "payable": False, "stateMutability": "view", "type": "function"},
{"constant": True, "inputs": [{"name": "_owner", "type": "address"}], "name": "balanceOf", "outputs": [{"name": "balance", "type": "uint256"}], "payable": False, "stateMutability": "view", "type": "function"}
]
INCH_NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
import logging
import time
from swap_agent_config import Config
from config import Config
from web3 import Web3


Expand Down

0 comments on commit 350392b

Please sign in to comment.