Skip to content

Commit

Permalink
tutorial80
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 8, 2024
1 parent 6a44dce commit a663c32
Show file tree
Hide file tree
Showing 5 changed files with 33,821 additions and 0 deletions.
Binary file added tutorial80/__pycache__/main.cpython-311.pyc
Binary file not shown.
18 changes: 18 additions & 0 deletions tutorial80/chain_api.py
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)
15 changes: 15 additions & 0 deletions tutorial80/main.py
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 added tutorial80/tutorial80.pptx
Binary file not shown.
Loading

0 comments on commit a663c32

Please sign in to comment.