pyBegin / projects / gpt-and-langchain
🐍

OpenAI and Langchain

+ About + Getting Started

52 lines🖥 Desktop only

OpenAI and Langchain

Table of Contents

About

Is LangChain using OpenAI? Generative AI Applications with LangChain and OpenAI API LangChain offers an OpenAI chat interface to call the model APIs into your application and create a question/answer pipeline that answers users' queries based on given context or input documents. It basically performs a vectorized search to find the most similar answer to the question

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

.\.venv\Scripts\activate
pip  install -r requirements.txt

API Documentation

Get API KEY from Telegram Bot

Get API KEY from OPenAI

Get API KEY from Notion Database

Get API KEY from Serapi

BOT_TOKEN= 'Telegram Bot Token'
OPENAI_API_KEY = 'API Key'
NOTION_TOKEN = 'Notion Token'
DATABASE_ID = 'Notion Database ID'
SERPAPI_API_KEY = 'SERP API Key'

Example

  1. Start the bot with py telegram-bot.py.
  2. Open Telegram and send /start to the bot — it replies "Howdy, how are you doing?".
  3. Send /Notion — the bot prompts "split differnet data with ,".
  4. Reply with your content; the bot uses the LangChain/OpenAI pipeline to generate a title and YouTube URL, then creates a Notion page with those values.

Runnning in local Host

py telegram-bot.py