-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
33,821 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,18 @@ | ||
from langchain_openai import OpenAI | ||
from langchain.chains import APIChain | ||
|
||
|
||
api_docs=""" | ||
base_url:http://localhost:8000 | ||
end point getzip/{name} uses GET requrest to give zip code of any given usa city, | ||
here name is url parameter which is actually the name of the city | ||
""" | ||
llm=OpenAI(temperature=0) | ||
chain=APIChain.from_llm_and_api_docs( | ||
llm, | ||
api_docs, | ||
verbose=True, | ||
limit_to_domains=["http://localhost:8000"] | ||
) | ||
response=chain.invoke("what is the zip code for Florida") | ||
print(response) |
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,15 @@ | ||
from typing import Union | ||
import pandas as pd | ||
from fastapi import FastAPI | ||
|
||
df=pd.read_csv(r"C:\Users\welcome\OneDrive\Documents\GitHub\LLMtutorial\tutorial80\uszips.csv") | ||
app = FastAPI() | ||
|
||
|
||
@app.get("/getzip/{name}") | ||
def getZip(name): | ||
df1=df[df["city"]==name] | ||
data=str(df1["zip"].values[0]) | ||
return {"Zipcode": "00"+data} | ||
|
||
|
Binary file not shown.
Oops, something went wrong.