Saravanan666/pypi-org huggingface dataset:
Package: llama-index-tools-weather
Open Weather Map ToolThis tool connects to theOpenWeatherMap's OneCall API, using thepyowmPython package. You must initialize the tool with your OpenWeatherMap API tokenThe tool has access to the following functions:the current weatherthe the weather tomorrowUsageHere's an example usage of the OpenWeatherMapToolSpec.fromllama_index.tools.weatherimportOpenWeatherMapToolSpecfromllama_index.agentimportOpenAIAgenttool_spec=OpenWeatherMapToolSpec(key="...")agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("What is the temperature like in Paris?")agent.chat("What is the wind like in Budapest tomorrow?")weather_at_location: Use pyowm to get current weather details at a locationforecast_tommorrow_at_location: Use pyowm to get the forecast for tomorrow at a location.
Package: llama-index-tools-wikipedia
Wikipedia ToolThis tool fetches content from wikipedia and makes it available to the agent as a Tool. You can search for pages or load pages directly.UsageThis tool has more extensive example usage documented in a Jupyter notebookherefromllama_index.tools.wikipediaimportWikipediaToolSpecfromllama_index.agentimportOpenAIAgenttool_spec=WikipediaToolSpec()agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("Who is Ben Afflecks spouse?")load_data: Loads a page from wikipediasearch_data: Searches wikipedia for a query and loads all matching pagesThis loader is designed to be used as a way to load data as a Tool in a Agent.
Seethis LlamaIndex tutorialfor examples.
Package: llama-index-tools-wolfram-alpha
Wolfram Alpha ToolThis tool connects to a Wolfram alpha account and allows an Agent to perform searchesYou will need to provide an API key:https://products.wolframalpha.com/apiUsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the WolframAlphaToolSpec.fromllama_index.tools.wolfram_alphaimportWolframAlphaToolSpecfromllama_index.agentimportOpenAIAgentwolfram_spec=WolframAlphaToolSpec(app_id="API-key")agent=OpenAIAgent.from_tools(wolfram_spec.to_tool_list(),verbose=True)agent.chat("how many calories are in 100g of milk chocolate")agent.chat("what is the mass of the helium in the sun")wolfram_alpha_query: Get the result of a query from Wolfram AlphaThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-yahoo-finance
Yahoo Finance ToolThis tool connects to Yahoo Finance and allows an Agent to access stock, news, and financial data of a company.UsageHere's an example of how to use this tool:fromllama_index.tools.yahoo_financeimportYahooFinanceToolSpecfromllama_index.agentimportOpenAIAgenttool_spec=YahooFinanceToolSpec()agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("What is the price of Apple stock?")agent.chat("What is the latest news about Apple?")The tools available are:balance_sheet: A tool that returns the balance sheet of a company.income_statement: A tool that returns the income statement of a company.cash_flow: A tool that returns the cash flow of a company.stock_news: A tool that returns the latest news about a company.stock_basic_info: A tool that returns basic information about a company including price.stock_analyst_recommendations: A tool that returns analyst recommendations for a company.This loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-yelp
Yelp ToolThis tool connects to Yelp and allows the Agent to search for business and fetch the reviews.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the YelpToolSpec.fromllama_index.tools.yelpimportYelpToolSpectool_spec=YelpToolSpec(api_key="your-key",client_id="your-id")agent=OpenAIAgent.from_tools(zapier_spec.to_tool_list(),verbose=True)agent.chat("what good restaurants are in toronto")agent.chat("what are the details of lao lao bar")business_search: Use a natural language query to search for businessesbusiness_reviews: Use a business id to fetch reviewsThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-zapier
Zapier ToolThis tool connects to a Zapier account and allows access to the natural language actions API. You can learn more about and enable the NLA API here:https://nla.zapier.com/start/UsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the ZapierToolSpec.fromllama_index.tools.zapierimportZapierToolSpecfromllama_index.agentimportOpenAIAgentzapier_spec=ZapierToolSpec(api_key="sk-ak-your-key")## Orzapier_spec=ZapierToolSpec(api_key="oauth-token")agent=OpenAIAgent.from_tools(zapier_spec.to_tool_list(),verbose=True)agent.chat("what actions are available")agent.chat("Can you find the taco night file in google drive")list_actions: Get the actions that you have enabled through zapiernatural_language_query: Make a natural language query to zapierThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-vector-stores-astra-db
Astra DB Vector StoreA LlamaIndex vector store using Astra DB as the backend.UsagePre-requisite:pipinstallllama-index-vector-stores-astra-dbA minimal example:fromllama_index.vector_stores.astra_dbimportAstraDBVectorStorevector_store=AstraDBVectorStore(token="AstraCS:xY3b...",# Your Astra DB tokenapi_endpoint="https://012...abc-us-east1.apps.astra.datastax.com",# Your Astra DB API endpointcollection_name="astra_v_table",# Table name of your choiceembedding_dimension=1536,# Embedding dimension of the embeddings model used)More examples and referencesA more detailed usage guide can be foundat this demo notebookin the LlamaIndex docs.Note: Please see the AstraDB documentationhere.
Package: llama-lime
LLaMa LIMEThis Python library use the power of large language models to provide intuitive, human-readable explanations for the predictions made by machine learning models.FeaturesSupport for scikit-learn and PyTorch modelsIntegration with OpenAI's language models for explanation generationWorks with both classification and regression modelsfromsklearn.ensembleimportRandomForestClassifierfromsklearn.datasetsimportload_irisfromai_explainabilityimportExplaineriris=load_iris()X,y=iris.data,iris.targetrandom_forest=RandomForestClassifier()random_forest.fit(X,y)# Create an explainerexplainer=Explainer(random_forest,language_model="openai/gpt-4")explanations=explainer.explain(X)For more detailed usage, see our Jupyter notebooks in theexamples/directory.ContributingWe welcome contributions! See our contribution guide for more details.LicenseThis project is licensed under the terms of the MIT license.TODOSupport for more model types: Currently, Llama-LIME supports scikit-learn models. In the future, we aim to add support for other types of models, such as PyTorch and TensorFlow models.Support for Hugging Face models: In addition to scikit-learn models, we aim to add support for Hugging Face models. This would allow Llama-LIME to generate explanations for a wide range of state-of-the-art natural language processing models.Improved explanation generation: The current explanation generation process is quite basic. We need to further refine this process to generate more detailed and useful explanations.Model inspection capabilities: For more complex models, we might need to add functionality to inspect the internal workings of the model. This could involve using model interpretation techniques like LIME or SHAP.Data preprocessing functionality: We may need to add functionality to preprocess the data before feeding it to the model or the explanation generation system.Postprocessing of explanations: After generating the explanations, we may want to add postprocessing steps to make the explanations more readable or understandable. This could include summarization, highlighting, or conversion to other formats.Testing: We need to add comprehensive testing to ensure the reliability and robustness of Llama-LIME.Documentation: While we have made a start on documentation, we need to continue to expand and improve it.Examplesand tutorials: We should create more example notebooks and tutorials demonstrating how to use Llama-LIME with different types of data and models.Community engagement: As an open-source project, we want to encourage community involvement. We need to continue improving our contribution guidelines and fostering an inclusive and welcoming community.feature naming--> can we use feature name to guide description
Package: llama-mqtt
An opinionated library for writing services on a MQTT message bus.Why?Something along the lines of: After implementingDaliQTTI wanted something more
generalized to create new services more easily.Also seeAlpaca, the Go
implementation of this library.InstallationThe package is available via pypi asllama-mqtt, so for installation
just type:pip3 install llama-mqttHow to useCreating a new service in your network is now as easy as:# Connect to MQTT broker and start dispatch loopdispatch,receive=mqtt.connect("localhost:1883",{"strings":"v1/simple/strings",})handle(dispatch,receive())With a handler likedefhandle(dispatch,actions):"""Process incoming actions"""foractioninactions:ifaction["type"]==REVERSE_REQUEST:dispatch(_handle_reverse(action["payload"]))Thereceivefunction can be used in a blocking and non-blocking
fashion by passing atimeoutin seconds (e.g.receive(timeout=0.25)and it can be used in a one shot kind of way,
by passingonce=True.This wayreceive(once=True)will block until an action is received,
or (if specified) thetimeoutwill occure.Error handlingIn case decoding the MQTT payload failed, anllama.actions.MESSAGE_DECODE_ERROR_RESULTis received.ExampleFor a simple working example please checkout theexamples/reverser/reverser.pystring reversal service.
Package: llama-parse
LlamaParseLlamaParse is an API created by LlamaIndex to efficiently parse and represent files for efficient retrieval and context augmentation using LlamaIndex frameworks.LlamaParse directly integrates withLlamaIndex.Currently available in preview mode forfree. Try it out today!NOTE:Currently, only PDF files are supported.Getting StartedFirst, login and get an api-key fromhttps://cloud.llamaindex.ai.Then, make sure you have the latest LlamaIndex version installed.NOTE:If you are upgrading from v0.9.X, we recommend following ourmigration guide, as well as uninstalling your previous version first.pip uninstall llama-index  # run this if upgrading from v0.9.x or older
pip install -U llama-index --upgrade --no-cache-dir --force-reinstallLastly, install the package:pip install llama-parseNow you can run the following to parse your first PDF file:importnest_asyncionest_asyncio.apply()fromllama_parseimportLlamaParseparser=LlamaParse(api_key="llx-...",# can also be set in your env as LLAMA_CLOUD_API_KEYresult_type="markdown",# "markdown" and "text" are availablenum_workers=4,# if multiple files passed, split in `num_workers` API callsverbose=True,language="en"# Optionaly you can define a language, default=en)# syncdocuments=parser.load_data("./my_file.pdf")# sync batchdocuments=parser.load_data(["./my_file1.pdf","./my_file2.pdf"])# asyncdocuments=awaitparser.aload_data("./my_file.pdf")# async batchdocuments=awaitparser.aload_data(["./my_file1.pdf","./my_file2.pdf"])Using withSimpleDirectoryReaderYou can also integrate the parser as the default PDF loader inSimpleDirectoryReader:importnest_asyncionest_asyncio.apply()fromllama_parseimportLlamaParsefromllama_index.coreimportSimpleDirectoryReaderparser=LlamaParse(api_key="llx-...",# can also be set in your env as LLAMA_CLOUD_API_KEYresult_type="markdown",# "markdown" and "text" are availableverbose=True)file_extractor={".pdf":parser}documents=SimpleDirectoryReader("./data",file_extractor=file_extractor).load_data()Full documentation forSimpleDirectoryReadercan be found on theLlamaIndex Documentation.ExamplesSeveral end-to-end indexing examples can be found in the examples folderGetting StartedAdvanced RAG ExampleRaw API UsageTerms of ServiceSee theTerms of Service Here.
Package: llama-parser
Llama Parser (Preview)Llama Parser is an API created by LlamaIndex to effeciently parse and represent files for effecient retrieval and context augmentation using LlamaIndex frameworks.Available for free as a preivew, you can try it out today.NOTE:Currently, only PDF files are supported.Getting StartedFirst, login and get an api-key fromhttps://cloud.llamaindex.ai.Simply install the package:pip install llama-parserThen, you can run the following to parse your first PDF file:fromllama_parserimportLlamaParserparser=LlamaParser(api_key="...",# can also be set in your env as LLAMA_CLOUD_API_KEYresult_type="markdown"# "markdown" and "text" are available)# syncdocuments=parser.load_data("./my_file.pdf")# asyncdocuments=awaitparser.aload_data("./my_file.pdf")Using withSimpleDirectoryReaderYou can also integrate the parser as the default PDF loader inSimpleDirectoryReader:fromllama_parserimportLlamaParserfromllama_indeximportSimpleDirectoryReaderparser=LlamaParser(api_key="...",# can also be set in your env as LLAMA_CLOUD_API_KEYresult_type="markdown"# "markdown" and "text" are available)file_extractor={".pdf":parser}documents=SimpleDirectoryReader("./data",file_extractor=file_extractor).load_data()Full documentation forSimpleDirectoryReadercan be found on theLlamaIndex Documentation.ExamplesServeral end-to-end indexing examples can be found in the examples folderGetting StartedAdvanced RAG ExampleRaw API Usage
Package: llamapay
ape-llamapayManageLlamaPaypayment streams effortlessly fromApe Framework.Quick UsageYou can use this SDK inape consoleor in ape scripts. A short example:fromllamapayimportFactoryfactory=Factory()factory.create_stream('banteg.eth','1000 DAI/month',sender=accounts.load('dev'))If deployment exists on the connected network, it will be automatically picked up.AFactoryis a registry and deployer of new pools. EachPoolmanages all streams of a specific token. AStreamstores metadata likesource,target,rateand allows operations on streams.You can find pools by token address or symbol, courtesy ofape-tokens:factory.poolsfactory.create_pool('YFI')factory.get_pool('DAI')You can find streams from event logs and filter them bysourceortarget, including their ENS names, courtesy ofape-ens:pool.all_streamspool.find_streams(source='ychad.eth')pool.find_streams(target='wentokyo.eth')To fund your streams you will need to deposit funds into a pool:pool.get_balance('ychad.eth')# infinite approve (optional)pool.approve(sender=dev)# auto approves the requested amountpool.deposit('1000 DAI',sender=dev)# withdraw allpool.withdraw(sender=dev)# withdraw somepool.withdraw(Decimal('500'),sender=dev)Token amounts can be specified asintfor wei,Decimalfor tokens, orstrto be converted byape-tokensbased on their decimals.It is easiest to prepare a stream from thePoolinstance:stream=pool.make_stream(source=dev,target=crush,rate='1000 DAI/month')You can specify the rate asintfor the internal 1e20 tokens per second representation or use a simplestrformat ofamount symbol/durationlike1 YFI/weekor200,000 UNI/year.Now that you have aStreamprepared, you can create it:stream.create(sender=dev)stream.pause(sender=dev)stream.cancel(sender=dev)stream.replace(new_stream,sender=dev)stream.modify(target=new_crush,sender=dev)stream.modify(rate=stream.rate*2,sender=dev)# check your withdrawable balancestream.balance# push tokens to recipient or withdraw them if you are one (these methods are the same)stream.send(sender=dev)stream.withdraw(sender=dev)Dependenciespython3version 3.7 or greater, python3-devInstallationviapipYou can install the latest release viapip:pipinstallllamapayviasetuptoolsYou can clone the repository and usesetuptoolsfor the most up-to-date version:gitclonehttps://github.com/banteg/ape-llamapay.gitcdape-llamapay
python3setup.pyinstallDevelopmentThis project is in development and should be considered a beta.
Things might not be in their final state and breaking changes may occur.
Comments, questions, criticisms and pull requests are welcomed.LicenseThis project is licensed under theApache 2.0.
Package: llama-rs-python
llama-rs-pythonUnofficial python bindings forllama-rscreated withPyO3. 🐍❤️🦀This package gives access to the basic functionality of the llama-rs project.GGML converted models can be loaded and executed.InstallationSimply install it via pip:pip install llama-rs-pythonUsageThe package is typehinted for easy usage.A usage example could look like this:fromllama_rs_pythonimportModel#load the modelmodel=Model("path/to/model.bin")#generateprint(model.generate("The meaning of life is"))The package also supports callbacks to get each token as it is generated.
The callback-function also supports canceling the generation by returning aTruevalue from the pytohn side.fromllama_rs_pythonimportModelimportsysfromtypingimportOptional#load the modelmodel=Model("path/to/model.bin")#define the callbackdefcallback(token:str)->Optional[bool]:print(token,end="")sys.stdout.flush()# (return True here to cancel the generation)#start generationmodel.generate("The meaning of life is",callback=callback)The configuration of the generation is handled by theGenerationConfigclass.fromllama_rs_pythonimportModel,GenerationConfig#load the modelmodel=Model("path/to/model.bin")#create a configconfig=GenerationConfig(top_p=0.9,seed=1441,max_new_tokens=1024)#generateprint(model.generate("The meaning of life is",generation_config=config))To configure model specific settings theSessionConfigclass can be used.fromllama_rs_pythonimportModel,SessionConfig#define the sessionsession_config=SessionConfig(threads=8,context_length=512)#load the modelmodel=Model("path/to/model.bin",session_config=session_config)
Package: llama-server
LLaMA ServerLLaMA Server combines the power ofLLaMA C++(viaPyLLaMACpp) with the beauty ofChatbot UI.🦙LLaMA C++ (via 🐍PyLLaMACpp) ➕ 🤖Chatbot UI ➕ 🔗LLaMA Server 🟰 😊UPDATE: Greatly simplified implementation thanks to theawesome Pythonic APIsof PyLLaMACpp 2.0.0!UPDATE: Now supports better streaming throughPyLLaMACpp!UPDATE: Now supports streaming!DemoBetter Streaminghttps://user-images.githubusercontent.com/10931178/231539194-052f7c5f-c7a3-42b7-9f8b-142422e42a67.movStreaminghttps://user-images.githubusercontent.com/10931178/229980159-61546fa6-2985-4cdc-8230-5dcb6a69c559.movNon-streaminghttps://user-images.githubusercontent.com/10931178/229408428-5b6ef72d-28d0-427f-ae83-e23972e2dcff.movSetupGet your favorite LLaMA models byDownload from🤗Hugging Face;Or follow instructions atLLaMA C++;Make sure models are converted and quantized;Create amodels.ymlfile to provide yourmodel_homedirectory and add your favoriteSouth American camelids, e.g.:model_home:/path/to/your/modelsmodels:llama-7b:name:LLAMA-7Bpath:7B/ggml-model-q4_0.bin# relative to `model_home` or an absolute pathSeemodels.ymlfor an example.Set up python environment:condacreate-nllamapython=3.9
condaactivatellamaInstall LLaMA Server:From PyPI:python-mpipinstallllama-serverOr from source:python-mpipinstallgit+https://github.com/nuance1979/llama-server.gitStart LLaMA Server with yourmodels.ymlfile:llama-server--models-ymlmodels.yml--model-idllama-7bCheck outmy forkof Chatbot UI and start the app;gitclonehttps://github.com/nuance1979/chatbot-uicdchatbot-ui
gitcheckoutllama
npmi
npmrundevOpen the linkhttp://localhost:3000in your browser;Click "OpenAI API Key" at the bottom left corner and enter yourOpenAI API Key;Or follow instructions atChatbot UIto put your key into a.env.localfile and restart;cp.env.local.example.env.local
<edit.env.localtoaddyourOPENAI_API_KEY>Enjoy!MoreTry a larger model if you have it:llama-server--models-ymlmodels.yml--model-idllama-13b# or any `model_id` defined in `models.yml`Try non-streaming mode by restarting Chatbot UI:exportLLAMA_STREAM_MODE=0# 1 to enable streamingnpmrundevFun factsI am not fluent in JavaScript at all but I was able to make the changes in Chatbot UI by chatting withChatGPT; no more StackOverflow.
Package: llama-test
LLAMAThis is an openai model that able you to give your own text to it and ask question of that text from model.To use this model first you need to buy a token from openai.link of model documentation:https://docs.llamaindex.ai/How to use Model:lama = llama_model("Your data text file directory, "Your open ai token)
result = lama.getquery("Your query)
print(result)
Package: llama-trainer
🦙 Llama Trainer UtilityA "just few lines of code" utility for fine-tuning (not only) Llama models.To install:pipinstallllama-trainerTraining and InferenceTrainingfromllama_trainerimportLlamaTrainerfromdatasetsimportload_datasetdataset=load_dataset("timdettmers/openassistant-guanaco")# define your instruction-based sampledefto_instruction_fn(sample):returnsample["text"]formatting_func=to_instruction_fnoutput_dir="llama-2-7b-hf-finetune"llama_trainer=LlamaTrainer(model_name="meta-llama/Llama-2-7b-hf",dataset=dataset,formatting_func=formatting_func,output_dir=output_dir)llama_trainer.train()Inferencefromllama_trainerimportLlamaInferimporttransformersastrllama_infer=LlamaInfer(output_dir)prompt="### Human: Give me some output!### Assistant:"print(llama_infer(prompt))
Package: llamazure.azgraph
llamazure.azgraph : Azure Resources Graph clientThellamazure.azgraphpackage provides a usable client for the Azure Resource Graph.Benefits:automatically queries all your subscriptionsno boilerplateeasily navigate paginated queriesazgraphUsageCreate aGraphwith thefrom_credentialand any of the standard Azure credentials.fromazure.identityimportDefaultAzureCredentialfromllamazure.azgraph.azgraphimportGraphg=Graph.from_credential(DefaultAzureCredential())QueryingMake a simple query with theqmethod, which will return your data directly:>>>g.q("Resources | project id, name, type, location | limit 5")[{'id':'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg0/providers/Microsoft.Storage/storageAccounts/sa0','name':'sa0','type':'microsoft.storage/storageaccounts','location':'canadacentral'}]Or specify options with thequerymethod, which will return the full result object:>>>fromllamazure.azgraph.modelsimportReq>>>g.query(Req(query="Resources | project id, name, type, location | limit 1",subscriptions=g.subscriptions,options={"$skip":1},))Res(req=Req(query='Resources | project id, name, type, location | limit 1',subscriptions=('00000000-0000-0000-0000-000000000000',),facets=(),managementGroupId=None,options={'$skip':1}),totalRecords=1,count=1,resultTruncated='false',facets=[],data=[{'id':'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_canadacentral','name':'NetworkWatcher_canadacentral','type':'microsoft.network/networkwatchers','location':'canadacentral'}],skipToken=None)RetriesEvery query can be automatically retried by the retry policy. You can modify this by setting theGraph.retry_policyattribute:g.retry_policy=RetryPolicy(retries=10)PaginationPagination is handled automatically. If you want to manually paginate, you can manually walk the pages:req=Req(query="Resources | project id, name, type, location | limit 5",subscriptions=g.subscriptions)res0=g.query_single(req)res1=g.query_next(req,res0)res2=g.query_next(req,res1)