Merge remote-tracking branch 'paikchu/dev' into test-merge
This commit is contained in:
commit
97fd6506dd
10
cli/utils.py
10
cli/utils.py
|
|
@ -151,6 +151,9 @@ def select_shallow_thinking_agent(provider) -> str:
|
||||||
],
|
],
|
||||||
"ollama": [
|
"ollama": [
|
||||||
("llama3.2 local", "llama3.2"),
|
("llama3.2 local", "llama3.2"),
|
||||||
|
],
|
||||||
|
"deepseek": [
|
||||||
|
("DeepSeek V3 - a 685B-parameter, mixture-of-experts model", "deepseek-chat")
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,6 +215,10 @@ def select_deep_thinking_agent(provider) -> str:
|
||||||
],
|
],
|
||||||
"ollama": [
|
"ollama": [
|
||||||
("qwen3", "qwen3"),
|
("qwen3", "qwen3"),
|
||||||
|
],
|
||||||
|
"deepseek": [
|
||||||
|
("DeepSeek V3 - a 685B-parameter, mixture-of-experts model", "deepseek-chat"),
|
||||||
|
("DeepSeek-R1 - latest iteration of the flagship chat model family from the DeepSeek team.", "deepseek-reasoner"),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,7 +252,8 @@ def select_llm_provider() -> tuple[str, str]:
|
||||||
("Anthropic", "https://api.anthropic.com/"),
|
("Anthropic", "https://api.anthropic.com/"),
|
||||||
("Google", "https://generativelanguage.googleapis.com/v1"),
|
("Google", "https://generativelanguage.googleapis.com/v1"),
|
||||||
("Openrouter", "https://openrouter.ai/api/v1"),
|
("Openrouter", "https://openrouter.ai/api/v1"),
|
||||||
("Ollama", "http://localhost:11434/v1"),
|
("Ollama", "http://localhost:11434/v1"),
|
||||||
|
("DeepSeek", "https://api.deepseek.com/v1")
|
||||||
]
|
]
|
||||||
|
|
||||||
choice = questionary.select(
|
choice = questionary.select(
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,8 @@ redis
|
||||||
chainlit
|
chainlit
|
||||||
rich
|
rich
|
||||||
questionary
|
questionary
|
||||||
|
langchain_anthropic
|
||||||
|
langchain_deepseek
|
||||||
|
langchain_google_genai
|
||||||
|
openai
|
||||||
|
sentence-transformers
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
import os
|
||||||
|
|
||||||
import chromadb
|
import chromadb
|
||||||
from chromadb.config import Settings
|
from chromadb.config import Settings
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
|
from sentence_transformers import SentenceTransformer
|
||||||
|
|
||||||
class FinancialSituationMemory:
|
class FinancialSituationMemory:
|
||||||
def __init__(self, name, config):
|
def __init__(self, name, config):
|
||||||
|
|
@ -9,17 +11,22 @@ class FinancialSituationMemory:
|
||||||
self.embedding = "nomic-embed-text"
|
self.embedding = "nomic-embed-text"
|
||||||
else:
|
else:
|
||||||
self.embedding = "text-embedding-3-small"
|
self.embedding = "text-embedding-3-small"
|
||||||
self.client = OpenAI()
|
|
||||||
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"""
|
||||||
|
if os.environ.get("OPENAI_API_KEY"):
|
||||||
response = self.client.embeddings.create(
|
client = OpenAI()
|
||||||
model=self.embedding, input=text
|
response = client.embeddings.create(
|
||||||
)
|
model=self.embedding, input=text
|
||||||
return response.data[0].embedding
|
)
|
||||||
|
return response.data[0].embedding
|
||||||
|
else:
|
||||||
|
model = SentenceTransformer("all-MiniLM-L6-v2")
|
||||||
|
embeddings = model.encode(text, convert_to_numpy=True)
|
||||||
|
return embeddings
|
||||||
|
|
||||||
|
|
||||||
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)"""
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import json
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from typing import Dict, Any, Tuple, List, Optional
|
from typing import Dict, Any, Tuple, List, Optional
|
||||||
|
|
||||||
|
from langchain_deepseek import ChatDeepSeek
|
||||||
from langchain_openai import ChatOpenAI
|
from langchain_openai import ChatOpenAI
|
||||||
from langchain_anthropic import ChatAnthropic
|
from langchain_anthropic import ChatAnthropic
|
||||||
from langchain_google_genai import ChatGoogleGenerativeAI
|
from langchain_google_genai import ChatGoogleGenerativeAI
|
||||||
|
|
@ -67,6 +68,9 @@ class TradingAgentsGraph:
|
||||||
elif self.config["llm_provider"].lower() == "google":
|
elif self.config["llm_provider"].lower() == "google":
|
||||||
self.deep_thinking_llm = ChatGoogleGenerativeAI(model=self.config["deep_think_llm"])
|
self.deep_thinking_llm = ChatGoogleGenerativeAI(model=self.config["deep_think_llm"])
|
||||||
self.quick_thinking_llm = ChatGoogleGenerativeAI(model=self.config["quick_think_llm"])
|
self.quick_thinking_llm = ChatGoogleGenerativeAI(model=self.config["quick_think_llm"])
|
||||||
|
elif self.config["llm_provider"].lower() == 'deepseek':
|
||||||
|
self.deep_thinking_llm = ChatDeepSeek(model=self.config["deep_think_llm"])
|
||||||
|
self.quick_thinking_llm = ChatDeepSeek(model=self.config["quick_think_llm"])
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unsupported LLM provider: {self.config['llm_provider']}")
|
raise ValueError(f"Unsupported LLM provider: {self.config['llm_provider']}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue