-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds LCEL class and adds a sample class for OpenAI
- Loading branch information
Showing
5 changed files
with
149 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "dialog-lib" | ||
version = "0.0.1.19" | ||
version = "0.0.1.20" | ||
description = "" | ||
authors = ["Talkd.AI <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -14,7 +14,7 @@ click = "^8.1.7" | |
pgvector = "^0.2.5" | ||
langchain-openai = "^0.1.8" | ||
psycopg2-binary = "^2.9.9" | ||
langchain-postgres = "^0.0.7" | ||
langchain-postgres = "0.0.7" | ||
langchain-community = "^0.2.5" | ||
langchain-anthropic = "^0.1.11" | ||
bs4 = "^0.0.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import logging | ||
from uuid import uuid4 | ||
from sqlalchemy import create_engine | ||
from sqlalchemy.orm import Session | ||
from dialog_lib.agents.openai import DialogLCELOpenAI | ||
|
||
logging.getLogger().setLevel(logging.ERROR) | ||
|
||
database_url = "postgresql://talkdai:talkdai@db:5432/test_talkdai" | ||
|
||
engine = create_engine(database_url) | ||
|
||
dbsession = Session(engine) | ||
|
||
|
||
agent = DialogLCELOpenAI( | ||
model="gpt-4o", | ||
temperature=0.1, | ||
llm_api_key=os.environ.get("OPENAI_API_KEY"), | ||
prompt="You are a bot called Sara. Be nice to other human beings.", | ||
dbsession=dbsession, | ||
config={ | ||
"database_url": database_url, | ||
}, | ||
session_id=str(uuid4()) | ||
) | ||
|
||
while True: | ||
input_text = input("You: ") | ||
output_text = agent.process(input_text) | ||
print(f"Sara: {output_text}") |