Skip to content

Instantly share code, notes, and snippets.

@jgoodie
Created November 3, 2024 17:23
Show Gist options
  • Save jgoodie/aec63fa763e1fe9e1343d6515cff2939 to your computer and use it in GitHub Desktop.
Save jgoodie/aec63fa763e1fe9e1343d6515cff2939 to your computer and use it in GitHub Desktop.
Imports for a basic Tavily search agent
import os
import logging
import operator
from typing import Annotated, List, TypedDict
import newspaper
from newspaper import Article, Source, Config
from langchain_openai import ChatOpenAI
from langgraph.graph import START, END, StateGraph
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain_core.messages import SystemMessage, HumanMessage
from IPython.display import Image, display
os.environ["OPENAI_API_KEY"] = "sk-proj-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
os.environ['TAVILY_API_KEY'] = "tvly-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
logger = logging.getLogger()
logging.basicConfig(encoding='utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment