Skip to content

Commit

Permalink
tutorial84
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 12, 2024
1 parent 5ccccd9 commit d7105a5
Show file tree
Hide file tree
Showing 10 changed files with 295 additions and 0 deletions.
File renamed without changes.
18 changes: 18 additions & 0 deletions tutorial84/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from bs4 import BeautifulSoup
import json
import xmltodict
from langchain.agents import create_json_agent
from langchain.agents.agent_toolkits import JsonToolkit
from langchain.tools.json.tool import JsonSpec
from langchain_openai import ChatOpenAI


with open(r"C:\Users\welcome\OneDrive\Documents\GitHub\LLMtutorial\tutorial84\sample.xml","r") as f1:
content=f1.read()
text_content=str(BeautifulSoup(content,"lxml"))
xml_dict=xmltodict.parse(text_content)
spec=JsonSpec(dict_=xml_dict)
toolkit=JsonToolkit(spec=spec)
agent=create_json_agent(llm=ChatOpenAI(temperature=0,model="gpt-4o"),toolkit=toolkit,max_iterations=3000,verbose=True)
response=agent.run("Please give all application names ,you will find it inside application key , it congtains a list")
print(response)
277 changes: 277 additions & 0 deletions tutorial84/sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
<Configurations>
<Application>
<Name>App1</Name>
<Version>1.0.0</Version>
<Developer>Alice Smith</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Debug</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>100</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>30</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App2</Name>
<Version>2.0.0</Version>
<Developer>Bob Johnson</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Info</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>200</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>60</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App3</Name>
<Version>3.1.0</Version>
<Developer>Charlie Davis</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Warning</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>150</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>45</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App4</Name>
<Version>4.2.1</Version>
<Developer>Dana Lee</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Error</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>120</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>90</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App5</Name>
<Version>5.0.0</Version>
<Developer>Eva Martinez</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Debug</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>300</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>25</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App6</Name>
<Version>1.1.1</Version>
<Developer>Frank Brown</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Info</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>400</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>35</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App7</Name>
<Version>2.2.2</Version>
<Developer>Grace Wilson</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Warning</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>250</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>50</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App8</Name>
<Version>3.3.3</Version>
<Developer>Hank White</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Error</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>220</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>75</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App9</Name>
<Version>4.4.4</Version>
<Developer>Ivy Clark</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Debug</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>180</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>20</Value>
</Setting>
</Settings>
</Application>
<Application>
<Name>App10</Name>
<Version>5.5.5</Version>
<Developer>Jack Lewis</Developer>
<Settings>
<Setting>
<Key>LogLevel</Key>
<Value>Info</Value>
</Setting>
<Setting>
<Key>MaxConnections</Key>
<Value>320</Value>
</Setting>
<Setting>
<Key>Timeout</Key>
<Value>40</Value>
</Setting>
</Settings>
</Application>
<Database>
<Host>localhost</Host>
<Port>5432</Port>
<Username>dbuser</Username>
<Password>dbpass</Password>
<DatabaseName>exampledb</DatabaseName>
<Tables>
<Table>
<Name>Users</Name>
<Columns>
<Column>
<Name>UserID</Name>
<Type>Integer</Type>
<PrimaryKey>true</PrimaryKey>
</Column>
<Column>
<Name>Username</Name>
<Type>String</Type>
<PrimaryKey>false</PrimaryKey>
</Column>
<Column>
<Name>Password</Name>
<Type>String</Type>
<PrimaryKey>false</PrimaryKey>
</Column>
</Columns>
</Table>
<Table>
<Name>Orders</Name>
<Columns>
<Column>
<Name>OrderID</Name>
<Type>Integer</Type>
<PrimaryKey>true</PrimaryKey>
</Column>
<Column>
<Name>UserID</Name>
<Type>Integer</Type>
<PrimaryKey>false</PrimaryKey>
</Column>
<Column>
<Name>Product</Name>
<Type>String</Type>
<PrimaryKey>false</PrimaryKey>
</Column>
<Column>
<Name>Quantity</Name>
<Type>Integer</Type>
<PrimaryKey>false</PrimaryKey>
</Column>
</Columns>
</Table>
</Tables>
</Database>
<Network>
<Endpoints>
<Endpoint>
<Name>API</Name>
<URL>https://api.example.com</URL>
<Methods>
<Method>GET</Method>
<Method>POST</Method>
</Methods>
</Endpoint>
<Endpoint>
<Name>Auth</Name>
<URL>https://auth.example.com</URL>
<Methods>
<Method>POST</Method>
</Methods>
</Endpoint>
</Endpoints>
</Network>
<Security>
<Encryption>
<Algorithm>AES-256</Algorithm>
<Key>supersecretkey</Key>
</Encryption>
<Authentication>
<Type>OAuth2</Type>
<TokenEndpoint>https://auth.example.com/token</TokenEndpoint>
<ClientID>clientid</ClientID>
<ClientSecret>clientsecret</ClientSecret>
</Authentication>
</Security>
</Configurations>
Binary file added tutorial84/test/chroma.sqlite3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tutorial84/tutorial84.pptx
Binary file not shown.

0 comments on commit d7105a5

Please sign in to comment.