Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions python/agent/crew-ai/src/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import wikipedia
import os
from pathlib import Path
from dotenv import load_dotenv, find_dotenv
from crewai import Agent, Crew, Process, Task
from crewai.tools import BaseTool as CrewAITool
from langchain_community.tools import DuckDuckGoSearchRun, WikipediaQueryRun
from langchain_community.utilities.wikipedia import WikipediaAPIWrapper
from observability import setup_observability
from pydantic import Field

# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

setup_observability()


Expand Down
9 changes: 6 additions & 3 deletions python/agent/langchain-agent/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dotenv import load_dotenv
from pathlib import Path
from dotenv import load_dotenv, find_dotenv
from langchain.agents import initialize_agent, Tool
from langchain.agents.agent_types import AgentType
from langchain_openai import ChatOpenAI
Expand All @@ -7,8 +8,10 @@
from galileo.handlers.langchain import GalileoCallback
import os

# Load environment variables (e.g., API keys)
load_dotenv()
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)


# Define a tool for the agent to use
Expand Down
10 changes: 7 additions & 3 deletions python/agent/langgraph-fsi-agent/after/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
from langchain_core.callbacks import Callbacks
from langchain_core.messages import HumanMessage, AIMessage

from dotenv import load_dotenv
import os
from pathlib import Path
from dotenv import load_dotenv, find_dotenv

from galileo import galileo_context
from galileo.handlers.langchain import GalileoAsyncCallback
Expand All @@ -19,8 +21,10 @@
create_supervisor_agent,
)

# Load environment variables from .env file
load_dotenv()
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)


# Build the agent graph
Expand Down
10 changes: 7 additions & 3 deletions python/agent/langgraph-fsi-agent/before/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
from langchain_core.callbacks import Callbacks
from langchain_core.messages import HumanMessage, AIMessage

from dotenv import load_dotenv
import os
from pathlib import Path
from dotenv import load_dotenv, find_dotenv

from src.galileo_langgraph_fsi_agent.agents.supervisor_agent import (
create_supervisor_agent,
)

# Load environment variables from .env file
load_dotenv()
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)


# Build the agent graph
Expand Down
8 changes: 6 additions & 2 deletions python/agent/minimal-agent-example/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
from pydantic import BaseModel
import json
from typing import Callable
from dotenv import load_dotenv
from pathlib import Path
from dotenv import load_dotenv, find_dotenv

load_dotenv()
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

client = openai.OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))

Expand Down
9 changes: 6 additions & 3 deletions python/agent/startup-simulator-3000/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import json
from typing import Dict, Any, List, Optional
from datetime import datetime
from dotenv import load_dotenv
from pathlib import Path
from dotenv import load_dotenv, find_dotenv
from galileo import GalileoLogger
from galileo.openai import openai

Expand All @@ -27,8 +28,10 @@
from tools.text_analysis import TextAnalyzerTool
from tools.keyword_extraction import KeywordExtractorTool

# Load environment variables
load_dotenv()
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Use the Galileo-wrapped OpenAI client
client = openai.OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Before we dive into the code ocean, make sure you've packed:
- **Python 3.8+** installed on your system
- **API Keys** (free options available):
- OpenAI API key (for agent reasoning)
- WeatherAPI key (for weather data)
- YouTube API key (for video recommendations)
- WeatherAPI key (for weather data https://www.weatherapi.com/)
- YouTube V3 API key (for video recommendations)
- Galileo API key (for monitoring and evaluation)
- **Development Environment**:
- Code editor of choice
Expand Down
9 changes: 6 additions & 3 deletions python/agent/weather-vibes-agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv
from galileo import log, galileo_context

# Load environment variables & set up path
load_dotenv()
# 1) load global/shared secrets first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)
#setup path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))

# Quick environment check
Expand Down
8 changes: 6 additions & 2 deletions python/chatbot/basic-examples/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import os
from galileo import openai, logger # The Galileo OpenAI client wrapper is all you need!

from dotenv import load_dotenv
from dotenv import load_dotenv ,find_dotenv

load_dotenv()
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

client = openai.OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"),
Expand Down
8 changes: 6 additions & 2 deletions python/chatbot/basic-examples/hallucination.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import time
import openai # Using the standard OpenAI library
from galileo import GalileoLogger # Import GalileoLogger for logging
from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

load_dotenv()
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Initialize the GalileoLogger
logger = GalileoLogger(project="hallucination", log_stream="dev")
Expand Down
8 changes: 6 additions & 2 deletions python/chatbot/basic-examples/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import openai # Using the standard OpenAI library
from galileo import GalileoLogger # Import GalileoLogger for logging

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

load_dotenv()
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Initialize the GalileoLogger
logger = GalileoLogger(project="chatbot", log_stream="test")
Expand Down
10 changes: 6 additions & 4 deletions python/chatbot/sample-project-chatbot/anthropic/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@

from anthropic import Anthropic

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

from galileo import galileo_context, log

# Load the environment variables from the .env file
# This will override any existing environment variables with the same name
load_dotenv(override=True)
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Set the model name from the environment variable
# If this is not set, raise an exception
Expand Down
9 changes: 6 additions & 3 deletions python/chatbot/sample-project-chatbot/anthropic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import time

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

from galileo import GalileoScorers
from galileo.datasets import create_dataset, get_dataset
Expand All @@ -27,8 +27,11 @@ def setup_module():
"""
print("Setting up test environment...")

# Load the environment variables from the .env file
load_dotenv()
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Verify required environment variables are set
# You will also need to set up the environment variables for your OpenAI API connection.
Expand Down
10 changes: 6 additions & 4 deletions python/chatbot/sample-project-chatbot/azure-inference/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
from azure.ai.inference.models import SystemMessage, UserMessage, AssistantMessage
from azure.core.credentials import AzureKeyCredential

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

from galileo import galileo_context, log

# Load the environment variables from the .env file
# This will override any existing environment variables with the same name
load_dotenv(override=True)
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Set the model name from the environment variable
# If this is not set, raise an exception
Expand Down
9 changes: 6 additions & 3 deletions python/chatbot/sample-project-chatbot/azure-inference/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import time

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

from galileo import GalileoScorers
from galileo.datasets import create_dataset, get_dataset
Expand All @@ -27,8 +27,11 @@ def setup_module():
"""
print("Setting up test environment...")

# Load the environment variables from the .env file
load_dotenv()
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Verify required environment variables are set
# You will also need to set up the environment variables for your OpenAI API connection.
Expand Down
10 changes: 6 additions & 4 deletions python/chatbot/sample-project-chatbot/openai-ollama/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@
from datetime import datetime
import os

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

from galileo import galileo_context, log
from galileo.openai import OpenAI

# Load the environment variables from the .env file
# This will override any existing environment variables with the same name
load_dotenv(override=True)
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Set the model name from the environment variable
# If this is not set, raise an exception
Expand Down
9 changes: 6 additions & 3 deletions python/chatbot/sample-project-chatbot/openai-ollama/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import time

from dotenv import load_dotenv
from dotenv import load_dotenv, find_dotenv

from galileo import GalileoScorers
from galileo.datasets import create_dataset, get_dataset
Expand All @@ -27,8 +27,11 @@ def setup_module():
"""
print("Setting up test environment...")

# Load the environment variables from the .env file
load_dotenv()
# Load environment variables
# 1) load global/shared first
load_dotenv(os.path.expanduser("~/.config/secrets/myapps.env"), override=False)
# 2) then load per-app .env (if present) to override selectively
load_dotenv(find_dotenv(usecwd=True), override=True)

# Verify required environment variables are set
# You will also need to set up the environment variables for your OpenAI API connection.
Expand Down
4 changes: 1 addition & 3 deletions typescript/agent/langgraph-fsi-agent/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createDataset, GalileoCallback, GalileoScorers, getDataset, getLogger, runExperiment } from "galileo";
import dotenv from 'dotenv';
import "./src/config/env"; // side-effect: loads env vars
import fs from 'fs';
import path from 'path';

Expand Down Expand Up @@ -35,8 +35,6 @@ const sendInputToLlm = async (datasetRow: any): Promise<string> => {

describe('Chatbot Galileo Tests', () => {
beforeAll(async () => {
// Load environment variables from .env file
dotenv.config();

// Verify required environment variables are set
// You will also need to set up the environment variables for your OpenAI API connection.
Expand Down
20 changes: 9 additions & 11 deletions typescript/agent/langgraph-fsi-agent/app.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
/**
* A demo Financial Services Agent using LangGraph, with Galileo as the evaluation platform.
*/
import "./src/config/env"; // side-effect: loads env vars
import * as readline from 'readline';

import { getLogger, GalileoCallback } from "galileo";
import { createSupervisorAgent } from './agents/supervisorAgent';

// Load environment variables from .env file
import dotenv from 'dotenv';
dotenv.config();

// Validate required environment variables
const requiredEnvVars = {
GALILEO_API_KEY: process.env.GALILEO_API_KEY,
GALILEO_PROJECT: process.env.GALILEO_PROJECT,
GALILEO_LOG_STREAM: process.env.GALILEO_LOG_STREAM,
MODEL_NAME: process.env.MODEL_NAME,
PINECONE_API_KEY: process.env.PINECONE_API_KEY,
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
};
const required = [
"GALILEO_API_KEY",
"GALILEO_PROJECT",
"GALILEO_LOG_STREAM",
"MODEL_NAME",
"PINECONE_API_KEY",
"OPENAI_API_KEY",
] as const;

for (const [key, value] of Object.entries(requiredEnvVars)) {
if (!value) {
Expand Down
Loading
Loading