Skip to content

Commit

Permalink
fix: added fireworks ai as LLM provider
Browse files Browse the repository at this point in the history
Trying to decouple from OpenAI, added fireworks ai as a provider for LLM.
Attempts to use other providers was unsuccessful, since function calling is
not properly executed by models like ollama gemma:2b or Together/Mistral mixtral-8x7b.
  • Loading branch information
broomva committed Mar 5, 2024
1 parent 00f639a commit ff66301
Show file tree
Hide file tree
Showing 10 changed files with 364 additions and 3,599 deletions.
1,106 changes: 0 additions & 1,106 deletions notebooks/00-mixtral-8x7b-agent.ipynb

This file was deleted.

714 changes: 0 additions & 714 deletions notebooks/agentchat_langchain.ipynb

This file was deleted.

882 changes: 0 additions & 882 deletions notebooks/agentchat_lmm_llava.ipynb

This file was deleted.

827 changes: 0 additions & 827 deletions notebooks/agentchat_planning.ipynb

This file was deleted.

57 changes: 34 additions & 23 deletions notebooks/vortex_agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/broomva/miniconda3/envs/vortex/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"outputs": [],
"source": [
"from vortex.ai.agents import VortexSession\n",
"from vortex.ai.agents import VortexSession, VortexAgent\n",
"from vortex.ai.llm import LLM\n",
"from vortex.datamodels import get_db_context"
]
},
Expand All @@ -28,30 +20,49 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Using reloaded agent with history [HumanMessage(content='Yo'), AIMessage(content='Hello! How can I assist you today?'), HumanMessage(content='Hola'), AIMessage(content='¡Hola! ¿En qué puedo ayudarte hoy?'), HumanMessage(content='Hey'), AIMessage(content='Hello! How can I assist you today?'), HumanMessage(content='Chat here'), AIMessage(content='Sure, feel free to chat here. What would you like to talk about or ask?'), HumanMessage(content='Puedes hablar en español?'), AIMessage(content='¡Sí, puedo hablar en español! ¿En qué puedo ayudarte hoy?'), HumanMessage(content='Buenas tardes'), AIMessage(content='¡Buenas tardes! ¿Cómo estás? ¿Hay algo en lo que pueda ayudarte hoy?'), HumanMessage(content='Hola'), AIMessage(content='¡Hola! ¿En qué puedo ayudarte hoy?'), HumanMessage(content='Please search this website and summarize what it states https://www.omegle.com/'), AIMessage(content='The search results for the website \"https://www.omegle.com/\" provide various information about Omegle. Here is a summary of what the search results state:\\n\\n1. Omegle has had a positive impact beyond the site through its moderation efforts. It has worked with law enforcement agencies and the National Center for Missing and Exploited Children to help put wrongdoers in prison.\\n2. Omegle is available as an app that can be downloaded on Android and used on PC (Windows 10/8/7/XP) and iOS devices. It is a free chat room where users can connect with millions of people without the need for login.\\n3. Omegle was a free, web-based online chat service that allowed users to socialize with others without the need to register. The service randomly paired users in one-on-one chat sessions where they could chat anonymously.\\n4. Omegle was involved in a lawsuit, and the founder, Leif K. Brooks, shuttered the platform after settling the lawsuit.\\n5. Omegle\\'s alternative, Omegle TV, offers a platform for random video chat with hundreds of thousands of online users. Users can select a preferred country, define their gender, or choose to chat as a couple.\\n\\nIf you would like more detailed information or specific details about Omegle, feel free to ask!'), HumanMessage(content='Please search and summarize the key points of the elon musk vs openai lawsuit'), AIMessage(content=\"The key points of the Elon Musk vs OpenAI lawsuit are as follows:\\n\\n1. Elon Musk is suing OpenAI and its CEO, Sam Altman, for breach of contract. Musk claims that OpenAI has diverged from its original nonprofit mission by partnering with Microsoft for $13 billion and keeping its code for its newest generative AI products a secret.\\n2. Musk, who co-founded OpenAI in 2015, has formed his own AI company, xAI, which has taken OpenAI from a worthless state to a valuation of $90 billion in just a few years. Sam Altman is credited as the key to the company's success.\\n3. Musk's lawsuit seeks a judicial determination that GPT-4 (a product of OpenAI) constitutes Artificial General Intelligence (AGI) and is outside the scope of OpenAI's license to Microsoft.\\n4. The lawsuit alleges that the new OpenAI board, handpicked by Altman and Microsoft, is unlikely to declare that AGI has been reached, allowing Microsoft to continue profiting from the technology.\\n5. Musk donated $44 million to help start OpenAI and recruit leading AI researchers. The lawsuit is filed to compel OpenAI to adhere to its founding agreement and return to its mission of developing AGI for the benefit of humanity.\\n\\nThese are the main points surrounding the lawsuit between Elon Musk and OpenAI. If you would like more information or further details, please let me know!\"), HumanMessage(content='Explain spinoza’s god'), AIMessage(content=\"Baruch Spinoza, a prominent Dutch philosopher of the Age of Reason, introduced a unique concept of God in his philosophy. Spinoza's concept of God can be summarized as follows:\\n\\n1. **Pantheism**: Spinoza's God can be described as a pantheistic view where God is identified with the natural world and the universe as a whole. In Spinoza's philosophy, God and nature are one and the same. God is not a personal deity separate from the universe but is immanent in all things.\\n\\n2. **Substance Monism**: Spinoza proposed the concept of substance monism, which means that there is only one substance in the universe, and that substance is God or nature. According to Spinoza, everything that exists is a manifestation of this one substance.\\n\\n3. **Immutable and Infinite**: Spinoza's God is characterized as an immutable and infinite substance. God is not subject to change or emotions but is a necessary and eternal entity that encompasses all of reality.\\n\\n4. **Causal Determinism**: Spinoza's God is also associated with the concept of causal determinism, where all events and phenomena in the universe are determined by the laws of nature and the attributes of God. This deterministic view suggests that everything unfolds according to a predetermined order.\\n\\n5. **Ethical Implications**: Spinoza's philosophy of God has ethical implications as well. He believed that understanding and aligning oneself with the laws of nature (God) leads to a life of harmony and ethical living. By recognizing the interconnectedness of all things as manifestations of God, individuals can strive for a more rational and virtuous existence.\\n\\nOverall, Spinoza's concept of God challenges traditional anthropomorphic views of a personal deity and instead presents a philosophical framework where God is synonymous with the natural world, existing as a unified and all-encompassing entity.\"), HumanMessage(content='Please search and explain spinoza’s god'), AIMessage(content='Baruch Spinoza, also known as Benedictus de Spinoza, was a Jewish Dutch philosopher who significantly influenced modern biblical criticism, Rationalism, and conceptions of the self and the universe. He challenged traditional religious beliefs and was expelled from the Jewish community for defying rabbinic authorities. Spinoza\\'s philosophy encompassed various areas, including metaphysics, epistemology, political philosophy, ethics, and philosophy of mind.\\n\\nOne of Spinoza\\'s notable works is \"Ethics, Demonstrated in Geometrical Order,\" where he applied Euclid\\'s method in philosophy. In this work, Spinoza presented a small number of definitions and axioms from which he derived numerous propositions and corollaries, such as exploring the relationship between the mind, power, freedom, and eternity.\\n\\nRegarding Spinoza\\'s concept of God, he is often associated with pantheism, where God is identified with the natural world and the universe as a whole. Spinoza\\'s God is characterized as an immutable and infinite substance, representing the unity of all things in the universe. Spinoza\\'s God is not a personal deity but is immanent in all aspects of reality, emphasizing the interconnectedness of all existence.\\n\\nAlbert Einstein, a renowned physicist, expressed admiration for Spinoza\\'s concept of God, stating, \"I believe in Spinoza\\'s God.\" Einstein saw God as a universal force or lawgiver rather than a personal deity involved in human affairs. Einstein\\'s views on religion and God were aligned with Spinoza\\'s philosophical ideas, emphasizing a non-personal and transcendent understanding of the divine.\\n\\nSpinoza\\'s philosophy of God challenges conventional anthropomorphic views and presents a holistic and interconnected vision of the universe, where God is synonymous with nature and all of existence.'), HumanMessage(content='Can you please query the top 1 processed_articles table'), AIMessage(content='The top processed article in the database is as follows:\\n\\n- **Title**: Pittsburgh Hockey Now: Your Ultimate Destination for Pittsburgh Penguins News and Analysis\\n- **URL**: [Pittsburgh Hockey Now](https://pittsburghhockeynow.com/pittsburgh-penguins-links-week-in-review-crosby-bruins-capitals-sabres/)\\n- **Summary**: Pittsburgh Hockey Now is the premier online destination for all things related to the Pittsburgh Penguins. From game analysis and player profiles to news and features, they cover a wide range of topics related to the Pittsburgh Penguins.\\n- **Date and Time**: January 26, 2024, 7:19:38 AM (UTC)\\n\\nIf you need more information or have any specific questions about this article or any other topic, feel free to ask!')]\n"
"Using a new agent\n"
]
}
],
"source": [
"agent = VortexAgent(llm=LLM(provider='ChatOpenAI').llm)\n",
"vortex_session = VortexSession(session_factory=get_db_context())\n",
"agent = vortex_session.get_or_create_agent(user_id='+573017758620')"
"agent = vortex_session.get_or_create_agent(user_id='admin', provided_agent=agent)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m2024-03-04 23:38:17 INFO semantic_router.utils.logger local\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"No route found for query: please search wikipedia for most recent articles about artificial intelligence\n",
"The search on Wikipedia for \"Artificial Intelligence\" retrieved various relevant articles. Here are some summaries of the most recent articles related to artificial intelligence:\n",
"\n",
"1. **Artificial Intelligence**: Artificial intelligence (AI) refers to the intelligence exhibited by machines or software, as opposed to the intelligence of living beings, primarily humans. It is a field of study in computer science that develops and studies intelligent machines. AI technology is widely used across various industries for applications such as advanced web search engines, recommendation systems, human speech interaction, self-driving cars, generative and creative tools, and superhuman play in strategy games. The field of artificial intelligence has gone through cycles of optimism and disappointment, with significant advancements in recent years driven by deep learning and the transformer architecture. The growing use of AI is influencing societal and economic shifts towards increased automation and data-driven decision-making, raising ethical implications and the need for regulatory policies to ensure safety and benefits.\n",
"\n",
"2. **Generative Artificial Intelligence**: Generative artificial intelligence (generative AI or GAI) is AI capable of generating text, images, or other data using generative models in response to prompts. Recent advancements in transformer-based deep neural networks have led to a boom in generative AI systems. These systems include large language model chatbots, text-to-image artificial intelligence image generation systems, and text-to-video AI generators. Generative AI has applications across various industries such as software development, healthcare, finance, entertainment, customer service, art, writing, fashion, and more. However, concerns exist regarding the potential misuse of generative AI, such as cybercrime, fake news, and job displacement.\n",
"\n",
"3. **Artificial General Intelligence**: Artificial general intelligence (AGI) is a type of artificial intelligence that aims to exhibit human-like intelligence, including the ability to perform any task that a human can do. AGI is a long-term goal in the field of artificial intelligence, and researchers are working on developing systems capable of reasoning, knowledge representation, planning, learning, natural language processing, perception, and support for robotics. AGI research involves a wide range of problem-solving techniques, including search, mathematical optimization, neural networks, statistics, operations research, and more, drawing upon various fields such as psychology, linguistics, and neuroscience.\n",
"\n",
"These articles provide insights into the latest developments and applications of artificial intelligence across different domains.\n"
]
}
],
"source": [
"agent.get_response('please query the top 1 articles_summary table')"
"response = agent.get_response('please search wikipedia for most recent articles about artificial intelligence')\n",
"print(response)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit ff66301

Please sign in to comment.