chore: use free models
Signed-off-by: bjorn <bjornjee95@gmail.com>
This commit is contained in:
parent
a879868396
commit
9f2ea6bb5b
|
|
@ -6,3 +6,5 @@ src/
|
||||||
eval_results/
|
eval_results/
|
||||||
eval_data/
|
eval_data/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
.PHONY: setup
|
||||||
|
|
||||||
|
setup:
|
||||||
|
@if [ ! -d .venv ]; then \
|
||||||
|
echo "Creating virtual environment..."; \
|
||||||
|
python3 -m venv .venv; \
|
||||||
|
echo "Downloading uv binary..."; \
|
||||||
|
curl -sL https://github.com/astral-sh/uv/releases/download/0.7.12/uv-aarch64-apple-darwin.tar.gz -o .venv/bin/uv.tar.gz; \
|
||||||
|
tar -xzf .venv/bin/uv.tar.gz -C .venv/bin; \
|
||||||
|
mv .venv/bin/uv-aarch64-apple-darwin/uv .venv/bin/uv; \
|
||||||
|
chmod +x .venv/bin/uv; \
|
||||||
|
rm .venv/bin/uv.tar.gz; \
|
||||||
|
rm -rf /.venv/bin/uv-aarch64-apple-darwin; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
@echo "Installing dependencies with uv..."
|
||||||
|
@.venv/bin/uv pip install -r requirements.txt
|
||||||
|
@echo "Please enter your API keys:"
|
||||||
|
@bash -c 'read -s -p "FINNHUB_API_KEY: " FINNHUB_KEY; echo; \
|
||||||
|
read -s -p "OPENAI_API_KEY: " OPENAI_KEY; echo; \
|
||||||
|
echo "export FINNHUB_API_KEY=$$FINNHUB_KEY" > .env; \
|
||||||
|
echo "export OPENAI_API_KEY=$$OPENAI_KEY" >> .env; \
|
||||||
|
echo "API keys saved to .env file. Run '\''source .env'\'' to load them."'
|
||||||
|
|
@ -131,6 +131,7 @@ def select_shallow_thinking_agent() -> str:
|
||||||
("GPT-4.1-nano - Ultra-lightweight model for basic operations", "gpt-4.1-nano"),
|
("GPT-4.1-nano - Ultra-lightweight model for basic operations", "gpt-4.1-nano"),
|
||||||
("GPT-4.1-mini - Compact model with good performance", "gpt-4.1-mini"),
|
("GPT-4.1-mini - Compact model with good performance", "gpt-4.1-mini"),
|
||||||
("GPT-4o - Standard model with solid capabilities", "gpt-4o"),
|
("GPT-4o - Standard model with solid capabilities", "gpt-4o"),
|
||||||
|
("Deepseek R1","deepseek/deepseek-chat-v3-0324:free"),
|
||||||
]
|
]
|
||||||
|
|
||||||
choice = questionary.select(
|
choice = questionary.select(
|
||||||
|
|
@ -170,6 +171,7 @@ def select_deep_thinking_agent() -> str:
|
||||||
("o3-mini - Advanced reasoning model (lightweight)", "o3-mini"),
|
("o3-mini - Advanced reasoning model (lightweight)", "o3-mini"),
|
||||||
("o3 - Full advanced reasoning model", "o3"),
|
("o3 - Full advanced reasoning model", "o3"),
|
||||||
("o1 - Premier reasoning and problem-solving model", "o1"),
|
("o1 - Premier reasoning and problem-solving model", "o1"),
|
||||||
|
("Deepseek R1","deepseek/deepseek-chat-v3-0324:free"),
|
||||||
]
|
]
|
||||||
|
|
||||||
choice = questionary.select(
|
choice = questionary.select(
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,22 @@
|
||||||
import chromadb
|
import chromadb
|
||||||
from chromadb.config import Settings
|
from chromadb.config import Settings
|
||||||
from openai import OpenAI
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from sentence_transformers import SentenceTransformer
|
||||||
|
|
||||||
|
|
||||||
class FinancialSituationMemory:
|
class FinancialSituationMemory:
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.client = OpenAI()
|
self.embedding_model = SentenceTransformer("all-MiniLM-L6-v2")
|
||||||
self.chroma_client = chromadb.Client(Settings(allow_reset=True))
|
self.chroma_client = chromadb.Client(Settings(allow_reset=True))
|
||||||
self.situation_collection = self.chroma_client.create_collection(name=name)
|
self.situation_collection = self.chroma_client.create_collection(name=name)
|
||||||
|
|
||||||
def get_embedding(self, text):
|
def get_embedding(self, text):
|
||||||
"""Get OpenAI embedding for a text"""
|
"""Get OpenAI embedding for a text"""
|
||||||
response = self.client.embeddings.create(
|
# response = self.client.embeddings.create(
|
||||||
model="text-embedding-ada-002", input=text
|
# model="text-embedding-ada-002", input=text
|
||||||
)
|
# )
|
||||||
return response.data[0].embedding
|
# return response.data[0].embedding
|
||||||
|
return self.embedding_model.encode(text, convert_to_tensor=False)
|
||||||
|
|
||||||
def add_situations(self, situations_and_advice):
|
def add_situations(self, situations_and_advice):
|
||||||
"""Add financial situations and their corresponding advice. Parameter is a list of tuples (situation, rec)"""
|
"""Add financial situations and their corresponding advice. Parameter is a list of tuples (situation, rec)"""
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ DEFAULT_CONFIG = {
|
||||||
"dataflows/data_cache",
|
"dataflows/data_cache",
|
||||||
),
|
),
|
||||||
# LLM settings
|
# LLM settings
|
||||||
"deep_think_llm": "o4-mini",
|
"base_url": "https://openrouter.ai/api/v1",
|
||||||
"quick_think_llm": "gpt-4o-mini",
|
"deep_think_llm": "deepseek/deepseek-r1:free",
|
||||||
|
"quick_think_llm": "deepseek/deepseek-r1:free",
|
||||||
# Debate and discussion settings
|
# Debate and discussion settings
|
||||||
"max_debate_rounds": 1,
|
"max_debate_rounds": 1,
|
||||||
"max_risk_discuss_rounds": 1,
|
"max_risk_discuss_rounds": 1,
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@ class TradingAgentsGraph:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initialize LLMs
|
# Initialize LLMs
|
||||||
self.deep_thinking_llm = ChatOpenAI(model=self.config["deep_think_llm"])
|
self.deep_thinking_llm = ChatOpenAI(base_url=self.config['base_url'],model=self.config["deep_think_llm"])
|
||||||
self.quick_thinking_llm = ChatOpenAI(
|
self.quick_thinking_llm = ChatOpenAI(
|
||||||
|
base_url=self.config['base_url'],
|
||||||
model=self.config["quick_think_llm"], temperature=0.1
|
model=self.config["quick_think_llm"], temperature=0.1
|
||||||
)
|
)
|
||||||
self.toolkit = Toolkit(config=self.config)
|
self.toolkit = Toolkit(config=self.config)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue