Skip to content

Commit

Permalink
v0.1.3 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rlesueur committed Jun 26, 2024
1 parent 38b83d9 commit d965584
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 487 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ ReXia.AI is an advanced AI framework designed to integrate various language mode
- [License](#license)
- [Contact](#contact)

## Update v0.1.3

- Improved handling of JSON responses
- Removed LLMWare and Huggingface LLM types, they're still useable, just provide an OpenAI compatibile endpoint for them.
- Added 'PerplexityLite' example.
- resolved a minor bug with working memory in that messages added more recently to the list were being passed further down in the prompt. This was causing the LLM to think the oldest message was the most recent.

## Features

- Support for multiple language models (OpenAI, Hugging Face, LLMware)
- Support for multiple language models
- Extensible workflow system
- Built-in memory management
- Integration with various external tools and APIs
Expand Down
119 changes: 0 additions & 119 deletions docs/llms/rexia_ai_huggingface.md

This file was deleted.

106 changes: 0 additions & 106 deletions docs/llms/rexia_ai_llmware.md

This file was deleted.

6 changes: 4 additions & 2 deletions examples/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@

# Create an instance of the RexiaAI LLM
llm = RexiaAIOpenAI(
base_url="http://localhost:1234/v1",
base_url="https://api.01.ai/v1",
model="yi-large",
temperature=0,
model="lm-studio"
api_key=YI_LARGE_API_KEY
)


# Create an instance of the RexiaAI Agent with the specified task and LLM
agent = Agent(llm=llm, task="What is the capital of France?", verbose=True)

Expand Down
65 changes: 65 additions & 0 deletions examples/perplexity_lite_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
import gradio as gr
from rexia_ai.llms import RexiaAIOpenAI
from rexia_ai.agents import Agent
from rexia_ai.workflows import SimpleToolWorkflow
from rexia_ai.tools import RexiaAIGoogleSearch
from rexia_ai.structure import RexiaAIResponse

# Get the required keys from the environment variables
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
SEARCH_ENGINE_ID = os.getenv("SEARCH_ENGINE_ID")

class PerplexityLite():
"""A simple version of Perplexity using ReXia.AI, Gradio and Llama 3 8b."""
def __init__(self) -> None:
self.google_search = RexiaAIGoogleSearch(api_key=GOOGLE_API_KEY, engine_id=SEARCH_ENGINE_ID)

# Create a dictionary mapping the tool name to its instance
self.tools = {"google_search": self.google_search}

# Create an instance of the RexiaAILLMWare LLM and give it the tools
self.llm = RexiaAIOpenAI(
base_url="http://localhost:1234/v1",
model="QuantFactory/Meta-Llama-3-8B-Instruct-GGUF",
temperature=0.0,
tools=self.tools,
)

# Create an instance of the RexiaAI Agent with the specified task and LLM, we'll use the SimpleToolWorkflow here.
self.agent = Agent(llm=self.llm, task="", verbose=True, workflow=SimpleToolWorkflow)

def invoke(self, task: str) -> str:
"""Invoke the agent with the task."""
response = self.agent.invoke(task)
structured_response = RexiaAIResponse.from_json(str(response))

return structured_response.answer

# Create an instance of PerplexityLite
perplexity_lite = PerplexityLite()

# Define the Gradio interface
def chatbot(message, history):
"""Chatbot function that uses the PerplexityLite agent to generate a response."""
# Invoke the PerplexityLite agent with the message
response = perplexity_lite.invoke(message)
return response



# Create and launch the Gradio interface
iface = gr.ChatInterface(
fn=chatbot,
title="PerplexityLite Chatbot",
description="Ask me anything, and I'll use ReXia.AI, Gradio, and Llama 3 8b to find an answer!",
examples=[
"What's the weather like in New York today?",
"Tell me about the latest advancements in AI",
"How does quantum computing work?",
],
theme="soft",
)

if __name__ == "__main__":
iface.launch()
15 changes: 0 additions & 15 deletions examples/rexia_ai_huggingface_example.py

This file was deleted.

14 changes: 0 additions & 14 deletions examples/rexia_ai_llmware_example.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='rexia_ai',
version='0.1.2',
version='0.1.3',
author='Robyn Le Sueur',
author_email='[email protected]',
description='ReXia.AI: An advanced AI framework for agentic processes',
Expand Down
4 changes: 1 addition & 3 deletions src/rexia_ai/llms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Llms module for ReXia.AI."""

from .rexia_ai_openai import RexiaAIOpenAI
from .rexia_ai_llmware import RexiaAILLMWare
from .rexia_ai_huggingface import RexiaAIHuggingFace

__all__ = ["RexiaAIOpenAI", "RexiaAILLMWare", "RexiaAIHuggingFace"]
__all__ = ["RexiaAIOpenAI"]
Loading

0 comments on commit d965584

Please sign in to comment.