mer.vin Open in urlscan Pro
217.160.147.93  Public Scan

Submitted URL: http://mer.vin/
Effective URL: https://mer.vin/
Submission: On February 02 via api from US — Scanned from DE

Form analysis 1 forms found in the DOM

GET https://mer.vin/

<form role="search" aria-label="Search for:" method="get" class="search-form" action="https://mer.vin/">
  <label for="search-form-1">
    <span class="screen-reader-text"> Search for: </span>
    <input type="search" id="search-form-1" class="search-field" placeholder="Search …" value="" name="s">
  </label>
  <input type="submit" class="search-submit" value="Search">
</form>

Text Content

Skip to the content
Search


MERVIN PRAISON

Site Reliability Engineer
Menu
 * AI
 * DevOps
 * Coding
 * Contact

Search
Search for:
Close search
Close Menu
 * AI
 * DevOps
 * Coding
 * Contact

 * Github Profile
 * WordPress Profile
 * Kaggle Profile

Categories
Langchain


OPENGPTS

 * Post author By praison
 * Post date February 1, 2024

Terminal 1

docker run -p 6379:6379 -it redis/redis-stack:latest
docker ps

Terminal 2

git clone https://github.com/langchain-ai/opengpts
cd opengpts
cd backend
conda create -n opengpt python=3.11 -y
source activate opengpt
pip install -e .
export REDIS_URL=redis://127.0.0.1:6379
export OPENAI_API_KEY=xxxxxxxxxxxxxxx
export ROBOCORP_ACTION_SERVER_URL=https://dummy-action-server.robocorp.link
export ROBOCORP_ACTION_SERVER_KEY=dummy-api-key
export YDC_API_KEY=xxxxxxx
export TAVILY_API_KEY=xxxxxxx
langchain serve --port=8100

Terminal 3

cd frontend
yarn
yarn dev



--------------------------------------------------------------------------------

Categories
OpenAI


SPLIT AND TRANSCRIBE AUDIO FILES WITH OPENAI WHISPER API

 * Post author By praison
 * Post date January 31, 2024


SPLIT AUDIO FILES

Modify the code as per your requirement

This uses ffmpeg package

Original file name: large_filename.mp3

import subprocess
import os

def get_file_size(filename):
    """Get the size of the file in bytes."""
    return os.path.getsize(filename)

def calculate_duration_for_size(filename, target_size):
    """Calculate duration for the given target size."""
    total_size = get_file_size(filename)
    total_duration = get_duration(filename)
    proportion = target_size / total_size
    return total_duration * proportion

def get_duration(filename):
    """Get the duration of the audio file."""
    cmd = ['ffmpeg', '-i', filename, '-f', 'null', '-']
    result = subprocess.run(cmd, stderr=subprocess.PIPE, text=True)
    duration_line = [line for line in result.stderr.split('\n') if "Duration" in line]
    if duration_line:
        time_str = duration_line[0].split("Duration:")[1].split(",")[0].strip()
        hours, minutes, seconds = map(float, time_str.split(':'))
        total_seconds = hours * 3600 + minutes * 60 + seconds
        return total_seconds
    else:
        raise RuntimeError("Could not determine file duration.")

def split_audio(filename, target_size):
    """Split the audio file into parts based on the target size."""
    part_duration = calculate_duration_for_size(filename, target_size)
    total_duration = get_duration(filename)
    current_start = 0
    part_index = 1

    while current_start < total_duration:
        output_file = f"part_{part_index}.mp3"
        cmd = ['ffmpeg', '-i', filename, '-ss', str(current_start), '-t', str(part_duration), '-c', 'copy', output_file]
        subprocess.run(cmd)
        print(f"Part {part_index} created: {output_file}")
        current_start += part_duration
        part_index += 1

audio_file = "large_file.mp3"  # Replace with your audio file path
target_size = 24 * 1024 * 1024  # 24 MB in bytes

split_audio(audio_file, target_size)


move those split files inside a folder called folder_name ( Or provide your own
folder name)


M4A TO MP3

import os
import subprocess

def convert_m4a_to_mp3(folder_name):
    print(f"Processing folder: {folder_name}")

    # Get the full path of the folder
    full_folder_path = os.path.abspath(folder_name)

    # Loop through each file in the specified folder
    for audio_filename in os.listdir(full_folder_path):
        if audio_filename.endswith(".m4a"):
            # Construct the full path for the audio file
            full_audio_path = os.path.join(full_folder_path, audio_filename)

            # Construct the path for the new mp3 file
            mp3_filename = os.path.splitext(audio_filename)[0] + ".mp3"
            full_mp3_path = os.path.join(full_folder_path, mp3_filename)

            print(f"Converting {audio_filename} to {mp3_filename}")

            # Execute ffmpeg command to convert the file
            subprocess.run(['ffmpeg', '-i', full_audio_path, full_mp3_path])

            print(f"Conversion completed: {mp3_filename}")

# Convert files in 'folder_name' folders
convert_m4a_to_mp3("folder_name")



TRANSCRIBE

import os
import openai

def transcribe_folder(folder_name):
    client = openai.Client()
    print(f"Processing folder: {folder_name}")

    # Initialize an empty string to store combined transcript
    combined_transcript = ""

    # Get the full path of the folder
    full_folder_path = os.path.abspath(folder_name)

    # Loop through each file in the specified folder
    for audio_filename in os.listdir(full_folder_path):
        if audio_filename.endswith(".mp3"):
            # Construct the full path for the audio file
            full_audio_path = os.path.join(full_folder_path, audio_filename)
            print(f"Transcribing file: {full_audio_path}")

            with open(full_audio_path, "rb") as audio_file:
                transcript = client.audio.transcriptions.create(
                    model="whisper-1",
                    file=audio_file,
                )
                individual_transcript = transcript.text
                print(f"Transcription for {audio_filename} completed.")

                # Save individual transcript to a separate file
                individual_filename = os.path.splitext(audio_filename)[0] + ".txt"
                individual_file_path = os.path.join(full_folder_path, individual_filename)
                with open(individual_file_path, "w") as individual_file:
                    individual_file.write(individual_transcript)
                    print(f"Individual transcript saved: {individual_filename}")

                # Append transcript to the combined transcript
                combined_transcript += individual_transcript + "\n\n"

    # Write the combined transcript to a file
    combined_filename = f"{folder_name}_combined.txt"
    combined_file_path = os.path.join(full_folder_path, combined_filename)
    with open(combined_file_path, "w") as combined_file:
        combined_file.write(combined_transcript)
        print(f"Combined transcript saved: {combined_filename}")

# Transcribe files in 'folder_name' folders
transcribe_folder("folder_name")





--------------------------------------------------------------------------------

Categories
LLM


LLAVA MODEL UI SETUP

 * Post author By praison
 * Post date January 31, 2024


TERMINAL 1

git clone https://github.com/haotian-liu/LLaVA
cd LLaVA
conda create -n llava python=3.11 -y
conda activate llava
pip install --upgrade pip
pip install -e .

python -m llava.serve.controller --host 0.0.0.0 --port 10000


TERMINAL 2

python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.6-34b --load-4bit


TERMINAL 3

python -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload --share



--------------------------------------------------------------------------------

Categories
AutoGen


AUTOGEN OSS INSIGHT

 * Post author By praison
 * Post date January 27, 2024

import logging
import os
import requests
from autogen import UserProxyAgent, config_list_from_json
from autogen.agentchat.contrib.gpt_assistant_agent import GPTAssistantAgent

# Configure logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

# API schema for OSS Insight
ossinsight_api_schema = {
    "name": "ossinsight_data_api",
    "parameters": {
        "type": "object",
        "properties": {
            "question": {
                "type": "string",
                "description": (
                    "Enter your GitHub data question in the form of a clear and specific question "
                    "to ensure the returned data is accurate and valuable. "
                    "For optimal results, specify the desired format for the data table in your request."
                ),
            }
        },
        "required": ["question"],
    },
    "description": "API endpoint for querying GitHub data in text format.",
}

# Function to get data from OSS Insight API
def get_ossinsight(question):
    url = "https://api.ossinsight.io/explorer/answer"
    headers = {"Content-Type": "application/json"}
    data = {"question": question, "ignoreCache": True}

    response = requests.post(url, headers=headers, json=data)
    if response.status_code != 200:
        return f"Request to {url} failed with status code: {response.status_code}"

    answer = response.json()
    report_components = [
        f"Question: {answer['question']['title']}",
        f"querySQL: {answer['query']['sql']}" if answer["query"]["sql"] else "",
        "Result:\n  " + "\n  ".join([str(row) for row in answer["result"]["rows"]]) if answer.get("result") else "Result: N/A",
        f"Error: {answer['error']}" if answer.get("error") else ""
    ]
    return "\n\n".join(report_components) + "\n\n"

# Configure and create OSS Analyst Assistant Agent
assistant_id = os.environ.get("ASSISTANT_ID")
config_list = config_list_from_json("OAI_CONFIG_LIST")
llm_config = {
    "config_list": config_list,
    "assistant_id": assistant_id,
    "tools": [{"type": "function", "function": ossinsight_api_schema}],
}
oss_analyst = GPTAssistantAgent(
    name="OSS Analyst",
    code_execution_config={
        "work_dir": "coding",
        "use_docker": False,  
    },
    instructions=(
        "Hello, Open Source Project Analyst. Conduct evaluations of GitHub projects, analyzing trajectories, "
        "contributions, and trends. Address analysis questions or problems carefully."
    ),
    llm_config=llm_config,
    verbose=True,
)
oss_analyst.register_function(function_map={"ossinsight_data_api": get_ossinsight})

# Configure and create User Proxy Agent
user_proxy = UserProxyAgent(
    name="user_proxy",
    code_execution_config={
        "work_dir": "coding",
        "use_docker": False,  
    },
    is_termination_msg=lambda msg: "TERMINATE" in msg["content"],
    human_input_mode="NEVER",
    max_consecutive_auto_reply=1,
)

# Initiate chat with OSS Analyst
user_proxy.initiate_chat(oss_analyst, message="Top 10 developers with the most followers and plot a chart")


OAI_CONFIG_LIST

[
    {
        "model": "gpt-4-turbo-preview"
    }
]



--------------------------------------------------------------------------------

Categories
Tools


PIP INSTALL OLLAMA

 * Post author By praison
 * Post date January 26, 2024

ollama run mistral

import ollama

stream = ollama.chat(
    model='mistral',
    messages=[{'role': 'user', 'content': 'Why is the sky blue?'}],
    stream=True,
)

for chunk in stream:
  print(chunk['message']['content'], end='', flush=True)

Multimodal

import ollama

with open('image.jpeg', 'rb') as file:
  response = ollama.chat(
    model='llava',
    messages=[
      {
        'role': 'user',
        'content': 'What is in this image?',
        'images': [file.read()],
      },
    ],
  )
print(response['message']['content'])

All commands

import ollama

# Chat function
response = ollama.chat(model='mistral', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}])
print("Chat response:", response['message']['content'])

# Generate function
generate_response = ollama.generate(model='mistral', prompt='Why is the sky blue?')
print("Generate response:", generate_response['response'])

# List function
models_list = ollama.list()
print("List of models:", models_list)

# Show function
show_response = ollama.show('mistral')
print("Show model response:", show_response)

# Create function
modelfile = '''
FROM mistral
SYSTEM You are Mario from Super Mario Bros.
'''
create_response = ollama.create(model='example', modelfile=modelfile)
print("Create model response:", create_response)

# Copy function
copy_response = ollama.copy('mistral', 'user/mistral')
print("Copy model response:", copy_response)

# Delete function
delete_response = ollama.delete('example')
print("Delete model response:", delete_response)

# Pull function
pull_response = ollama.pull('mistral')
print("Pull model response:", pull_response)

# Push function
push_response = ollama.push('user/mistral')
print("Push model response:", push_response)

# Embeddings function
embeddings_response = ollama.embeddings(model='mistral', prompt='The sky is blue because of Rayleigh scattering')
print("Embeddings response:", embeddings_response)




--------------------------------------------------------------------------------

Categories
RAG


OLLAMA RAG

 * Post author By praison
 * Post date January 26, 2024

pip install ollama
pip install langchain beautifulsoup4 chromadb gradio

import ollama

stream = ollama.chat(
    model='mistral',
    messages=[{'role': 'user', 'content': 'Why is the sky blue?'}],
    stream=True,
)

for chunk in stream:
  print(chunk['message']['content'], end='', flush=True)


print(ollama.embeddings(model='mistral', prompt='They sky is blue because of rayleigh scattering'))

RAG

import ollama
import bs4
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.document_loaders import WebBaseLoader
from langchain_community.vectorstores import Chroma
from langchain_community.embeddings import OllamaEmbeddings
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough

loader = WebBaseLoader(
    web_paths=("http://localhost/llm.html",),
    bs_kwargs=dict(
        parse_only=bs4.SoupStrainer(
            class_=("post-content", "post-title", "post-header")
        )
    ),
)
docs = loader.load()
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
splits = text_splitter.split_documents(docs)

# Create Ollama embeddings and vector store
embeddings = OllamaEmbeddings(model="mistral")
vectorstore = Chroma.from_documents(documents=splits, embedding=embeddings)

# Create the retriever
retriever = vectorstore.as_retriever()

def format_docs(docs):
    return "\n\n".join(doc.page_content for doc in docs)

# Define the Ollama LLM function
def ollama_llm(question, context):
    formatted_prompt = f"Question: {question}\n\nContext: {context}"
    response = ollama.chat(model='mistral', messages=[{'role': 'user', 'content': formatted_prompt}])
    return response['message']['content']

# Define the RAG chain
def rag_chain(question):
    retrieved_docs = retriever.invoke(question)
    formatted_context = format_docs(retrieved_docs)
    return ollama_llm(question, formatted_context)

# Use the RAG chain
result = rag_chain("What is Task Decomposition?")
print(result)

UI

import gradio as gr
import bs4
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.document_loaders import WebBaseLoader
from langchain_community.vectorstores import Chroma
from langchain_community.embeddings import OllamaEmbeddings
import ollama

# Function to load, split, and retrieve documents
def load_and_retrieve_docs(url):
    loader = WebBaseLoader(
        web_paths=(url,),
        bs_kwargs=dict() 
    )
    docs = loader.load()
    text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
    splits = text_splitter.split_documents(docs)
    embeddings = OllamaEmbeddings(model="mistral")
    vectorstore = Chroma.from_documents(documents=splits, embedding=embeddings)
    return vectorstore.as_retriever()

# Function to format documents
def format_docs(docs):
    return "\n\n".join(doc.page_content for doc in docs)

# Function that defines the RAG chain
def rag_chain(url, question):
    retriever = load_and_retrieve_docs(url)
    retrieved_docs = retriever.invoke(question)
    formatted_context = format_docs(retrieved_docs)
    formatted_prompt = f"Question: {question}\n\nContext: {formatted_context}"
    response = ollama.chat(model='mistral', messages=[{'role': 'user', 'content': formatted_prompt}])
    return response['message']['content']

# Gradio interface
iface = gr.Interface(
    fn=rag_chain,
    inputs=["text", "text"],
    outputs="text",
    title="RAG Chain Question Answering",
    description="Enter a URL and a query to get answers from the RAG chain."
)

# Launch the app
iface.launch()





--------------------------------------------------------------------------------

Categories
AI Agents


LANGGRAPH AGENTS

 * Post author By praison
 * Post date January 26, 2024

pip install langchain langgraph langchain_openai langchainhub langsmith duckduckgo-search beautifulsoup4 gradio
export OPENAI_API_KEY=xxxxxxxxxx
export LANGCHAIN_API_KEY=xxxxxxxxxx

import functools, operator, requests, os, json
from bs4 import BeautifulSoup
from duckduckgo_search import DDGS
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_core.messages import BaseMessage, HumanMessage
from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langgraph.graph import StateGraph, END
from langchain.tools import tool
from langchain_openai import ChatOpenAI
from typing import Annotated, Any, Dict, List, Optional, Sequence, TypedDict
import gradio as gr

# Set environment variables
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_PROJECT"] = "LangGraph Research Agents"

# Initialize model
llm = ChatOpenAI(model="gpt-4-turbo-preview")

# 1. Define custom tools
@tool("internet_search", return_direct=False)
def internet_search(query: str) -> str:
    """Searches the internet using DuckDuckGo."""
    with DDGS() as ddgs:
        results = [r for r in ddgs.text(query, max_results=5)]
        return results if results else "No results found."

@tool("process_content", return_direct=False)
def process_content(url: str) -> str:
    """Processes content from a webpage."""
    response = requests.get(url)
    soup = BeautifulSoup(response.content, 'html.parser')
    return soup.get_text()

tools = [internet_search, process_content]

# 2. Agents 
# Helper function for creating agents
def create_agent(llm: ChatOpenAI, tools: list, system_prompt: str):
    prompt = ChatPromptTemplate.from_messages([
        ("system", system_prompt),
        MessagesPlaceholder(variable_name="messages"),
        MessagesPlaceholder(variable_name="agent_scratchpad"),
    ])
    agent = create_openai_tools_agent(llm, tools, prompt)
    executor = AgentExecutor(agent=agent, tools=tools)
    return executor

# Define agent nodes
def agent_node(state, agent, name):
    result = agent.invoke(state)
    return {"messages": [HumanMessage(content=result["output"], name=name)]}

# Create Agent Supervisor
members = ["Web_Searcher", "Insight_Researcher"]
system_prompt = (
    "As a supervisor, your role is to oversee a dialogue between these"
    " workers: {members}. Based on the user's request,"
    " determine which worker should take the next action. Each worker is responsible for"
    " executing a specific task and reporting back their findings and progress. Once all tasks are complete,"
    " indicate with 'FINISH'."
)

options = ["FINISH"] + members
function_def = {
    "name": "route",
    "description": "Select the next role.",
    "parameters": {
        "title": "routeSchema",
        "type": "object",
        "properties": {"next": {"title": "Next", "anyOf": [{"enum": options}] }},
        "required": ["next"],
    },
}

prompt = ChatPromptTemplate.from_messages([
    ("system", system_prompt),
    MessagesPlaceholder(variable_name="messages"),
    ("system", "Given the conversation above, who should act next? Or should we FINISH? Select one of: {options}"),
]).partial(options=str(options), members=", ".join(members))

supervisor_chain = (prompt | llm.bind_functions(functions=[function_def], function_call="route") | JsonOutputFunctionsParser())

search_agent = create_agent(llm, tools, "You are a web searcher. Search the internet for information.")
search_node = functools.partial(agent_node, agent=search_agent, name="Web_Searcher")

insights_research_agent = create_agent(llm, tools, 
        """You are a Insight Researcher. Do step by step. 
        Based on the provided content first identify the list of topics,
        then search internet for each topic one by one
        and finally find insights for each topic one by one.
        Include the insights and sources in the final response
        """)
insights_research_node = functools.partial(agent_node, agent=insights_research_agent, name="Insight_Researcher")

# Define the Agent State, Edges and Graph
class AgentState(TypedDict):
    messages: Annotated[Sequence[BaseMessage], operator.add]
    next: str

workflow = StateGraph(AgentState)
workflow.add_node("Web_Searcher", search_node)
workflow.add_node("Insight_Researcher", insights_research_node)
workflow.add_node("supervisor", supervisor_chain)

# Define edges
for member in members:
    workflow.add_edge(member, "supervisor")

conditional_map = {k: k for k in members}
conditional_map["FINISH"] = END
workflow.add_conditional_edges("supervisor", lambda x: x["next"], conditional_map)
workflow.set_entry_point("supervisor")

graph = workflow.compile()

# Run the graph
for s in graph.stream({
    "messages": [HumanMessage(content="""Search for the latest AI technology trends in 2024,
            summarize the content. After summarise pass it on to insight researcher
            to provide insights for each topic""")]
}):
    if "__end__" not in s:
        print(s)
        print("----")

# final_response = graph.invoke({
#     "messages": [HumanMessage(
#         content="""Search for the latest AI technology trends in 2024,
#                 summarize the content
#                 and provide insights for each topic.""")]
# })

# print(final_response['messages'][1].content)


USER INTERFACE

import functools, operator, requests, os, json
from bs4 import BeautifulSoup
from duckduckgo_search import DDGS
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_core.messages import BaseMessage, HumanMessage
from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langgraph.graph import StateGraph, END
from langchain.tools import tool
from langchain_openai import ChatOpenAI
from typing import Annotated, Any, Dict, List, Optional, Sequence, TypedDict
import gradio as gr

# Set environment variables
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_PROJECT"] = "LangGraph Research Agents"

# Initialize model
llm = ChatOpenAI(model="gpt-4-turbo-preview")

# Define custom tools
@tool("internet_search", return_direct=False)
def internet_search(query: str) -> str:
    """Searches the internet using DuckDuckGo."""
    with DDGS() as ddgs:
        results = [r for r in ddgs.text(query, max_results=5)]
        return results if results else "No results found."

@tool("process_content", return_direct=False)
def process_content(url: str) -> str:
    """Processes content from a webpage."""
    response = requests.get(url)
    soup = BeautifulSoup(response.content, 'html.parser')
    return soup.get_text()

tools = [internet_search, process_content]

# Helper function for creating agents
def create_agent(llm: ChatOpenAI, tools: list, system_prompt: str):
    prompt = ChatPromptTemplate.from_messages([
        ("system", system_prompt),
        MessagesPlaceholder(variable_name="messages"),
        MessagesPlaceholder(variable_name="agent_scratchpad"),
    ])
    agent = create_openai_tools_agent(llm, tools, prompt)
    executor = AgentExecutor(agent=agent, tools=tools)
    return executor

# Define agent nodes
def agent_node(state, agent, name):
    result = agent.invoke(state)
    return {"messages": [HumanMessage(content=result["output"], name=name)]}

# Create Agent Supervisor
members = ["Web_Searcher", "Insight_Researcher"]
system_prompt = (
    "As a supervisor, your role is to oversee a dialogue between these"
    " workers: {members}. Based on the user's request,"
    " determine which worker should take the next action. Each worker is responsible for"
    " executing a specific task and reporting back their findings and progress. Once all tasks are complete,"
    " indicate with 'FINISH'."
)

options = ["FINISH"] + members
function_def = {
    "name": "route",
    "description": "Select the next role.",
    "parameters": {
        "title": "routeSchema",
        "type": "object",
        "properties": {"next": {"title": "Next", "anyOf": [{"enum": options}] }},
        "required": ["next"],
    },
}

prompt = ChatPromptTemplate.from_messages([
    ("system", system_prompt),
    MessagesPlaceholder(variable_name="messages"),
    ("system", "Given the conversation above, who should act next? Or should we FINISH? Select one of: {options}"),
]).partial(options=str(options), members=", ".join(members))

supervisor_chain = (prompt | llm.bind_functions(functions=[function_def], function_call="route") | JsonOutputFunctionsParser())

# Define the Agent State and Graph
class AgentState(TypedDict):
    messages: Annotated[Sequence[BaseMessage], operator.add]
    next: str

search_agent = create_agent(llm, tools, "You are a web searcher. Search the internet for information.")
search_node = functools.partial(agent_node, agent=search_agent, name="Web_Searcher")

insights_research_agent = create_agent(llm, tools, 
        """You are a Insight Researcher. Do step by step. 
        Based on the provided content first identify the list of topics,
        then search internet for each topic one by one
        and finally find insights for each topic one by one.
        Include the insights and sources in the final response
        """)
insights_research_node = functools.partial(agent_node, agent=insights_research_agent, name="Insight_Researcher")

workflow = StateGraph(AgentState)
workflow.add_node("Web_Searcher", search_node)
workflow.add_node("Insight_Researcher", insights_research_node)
workflow.add_node("supervisor", supervisor_chain)

# Define edges
for member in members:
    workflow.add_edge(member, "supervisor")

conditional_map = {k: k for k in members}
conditional_map["FINISH"] = END
workflow.add_conditional_edges("supervisor", lambda x: x["next"], conditional_map)
workflow.set_entry_point("supervisor")

graph = workflow.compile()

# Run the graph
def run_graph(input_message):
    response = graph.invoke({
        "messages": [HumanMessage(content=input_message)]
    })
    return json.dumps(response['messages'][1].content, indent=2)

inputs = gr.inputs.Textbox(lines=2, placeholder="Enter your query here...")
outputs = gr.outputs.Textbox()

demo = gr.Interface(fn=run_graph, inputs=inputs, outputs=outputs)
demo.launch()


PROMPT

Search for the latest AI technology trends in 2024, summarise the content. After summarising pass it on to insight researcher to provide insights for each topic


OUTPUT

Let’s delve into insights derived from the latest findings on AI technology
trends for 2024:

1. Multimodal AI

 * Insight: Multimodal AI’s growth to a $4.5 billion market by 2028 underscores
   a significant shift towards AI systems that can handle a variety of inputs
   like text, images, and audio, akin to human sensory processing. This
   indicates a move towards more natural and intuitive AI-human interactions.
 * Sources: B12, Unite.AI

2. Agentic AI

 * Insight: The emergence of AI systems capable of autonomous action without
   direct supervision highlights a trend towards AI that can independently
   pursue complex goals. This could dramatically enhance efficiency in various
   sectors by enabling AI to take on more proactive roles.
 * Sources: GREY Journal, OpenAI

3. Open Source AI

 * Insight: Google’s partnership with Hugging Face to provide open-source AI
   tools on its cloud platform exemplifies the growing trend of democratizing AI
   technology. This movement aims to make powerful AI tools more accessible,
   fostering innovation across the board.
 * Sources: The Verge, TechRepublic

4. Retrieval-Augmented Generation (RAG)

 * Insight: RAG’s integration with fine-tuning methods tailored to specific
   industries, like agriculture, suggests a push towards making AI-generated
   content more accurate and relevant. This could significantly benefit sectors
   where factual precision is paramount.
 * Sources: Marktechpost, NVIDIA Blog

5. Customized Enterprise Generative AI Models

 * Insight: Enterprises are increasingly favoring customized generative AI
   models tailored with proprietary data, indicating a shift from
   one-size-fits-all solutions to more specific, efficient, and cost-effective
   AI applications.
 * Sources: Deloitte US, TechTarget

6. Quantum AI

 * Insight: The integration of AI with quantum computing, as seen in Microsoft’s
   Azure Quantum Elements, signifies a pursuit of breakthrough capabilities in
   complex problem-solving, potentially revolutionizing fields like drug
   discovery and climate modeling.
 * Sources: Microsoft, AIMultiple

7. AI Legislation

 * Insight: The momentum towards comprehensive AI policies, highlighted by
   actions such as President Biden’s executive order, reflects a growing
   recognition of the need to balance AI innovation with ethical considerations
   and societal protections.
 * Sources: MIT Technology Review, Scale

8. Ethical AI

 * Insight: The focus on developing AI systems that are transparent, fair, and
   accountable is becoming increasingly prominent. This trend towards ethical AI
   is driven by a global effort to ensure AI’s growth benefits society as a
   whole.
 * Sources: UNESCO, Forbes

9. Augmented Working

 * Insight: The concept of Augmented Working emphasizes a synergistic
   relationship between human capabilities and AI’s potential. This trend
   suggests a future where AI not only assists but enhances human work across
   various sectors.
 * Sources: Medium, Forbes

10. Next Generation of Generative AI

 * Insight: The evolution towards multi-modal generative AI systems capable of
   creating complex, multi-faceted outputs signals a future where AI can produce
   content that rivals human creativity, potentially transforming the landscape
   of content creation.
 * Sources: Forbes, MIT Technology Review

These insights provide a deeper understanding of the potential impacts and
opportunities associated with each of the AI technology trends for 2024.



--------------------------------------------------------------------------------

Categories
Tools


OPEN INTERPRETER SETUP

 * Post author By praison
 * Post date January 24, 2024


SETUP

conda create -n openinterpreter python=3.11 -y
conda activate openinterpreter
pip install open-interpreter
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxx
interpreter
interpreter -y (To Auto Approve the request)


OPEN SOURCE

Ollama

ollama run mistral
interpreter --model ollama/mistral

LM Studio

interpreter --local



--------------------------------------------------------------------------------

Categories
Tools


OPEN INTERPRETER FASTAPI

 * Post author By praison
 * Post date January 24, 2024


STREAMING

from fastapi import FastAPI
from fastapi.responses import StreamingResponse
from interpreter import interpreter
interpreter.auto_run = True
interpreter.llm.model: "gpt-4-1106-preview"

app = FastAPI()

@app.get("/chat")
def chat_endpoint(message: str):
    def event_stream():
        for result in interpreter.chat(message, stream=True):
            yield f"data: {result}\n\n"

    return StreamingResponse(event_stream(), media_type="text/event-stream")

@app.get("/history")
def history_endpoint():
    return interpreter.messages

Note: stream=False to stop streaming.


RUN

export OPENAI_API_KEY=st-xxxxxxxxxxxxxxxxxxx
pip install fastapi uvicorn
uvicorn server:app --reload


TEST

curl http://localhost:8000/chat\?message\=list+files+in+desktop



--------------------------------------------------------------------------------

Categories
Tools


OPEN INTERPRETER USE CASES

 * Post author By praison
 * Post date January 24, 2024

 * File & Folder Operations:

 1. Remove unused or unwanted files: We can write a script to delete certain
    files based on your requirements.
 2. Open a specific directory: If you want to navigate into a certain directory
    and list its files.
 3. Search for a specific file: If you’re looking for a specific file, we can
    write a script to find it for you.
 4. Create a new folder: We can help you create new folders and organize your
    files.
 5. Move certain files: Based on file type or name, we can move them into
    different folders.

 * Additional File Operations:

 1. File Search: Searching for a file pattern in your directories. If you
    remember partial file name we can find the full name and path of the file.
 2. Space Usage: Check the space used by each directory on your Desktop.
 3. File Content Search: Search for a specific text inside files.
 4. File Sorting: We can sort your files based on name, size, date created, or
    date modified.
 5. File Compression: If there are several files that you don’t commonly use, we
    can compress them to save some space.

 * System Information:

 1. System Update: We can check if your system is up to date with the latest
    patches and updates.
 2. Disk Usage: We could analyze the disk usage and understand which files or
    directories are taking the most space.
 3. Process Monitor: We could list all running processes on your machine.
 4. Hardware Information: We could gather and display hardware information, such
    as CPU, memory, etc.

 * Programming & Software Development:

 1. Coding Project: We could start a new coding project, such as a small script
    or a web application.
 2. Learning New Language: We could start learning basics of a new programming
    language.
 3. Running a program: If you’ve written a program and are experiencing any
    issues or want to see the output, we can do that.
 4. Understanding Code: If you have any piece of code that you’re having trouble
    understanding, we could go over it.
 5. Coding Challenge: We could find and work on a coding problem from challenge
    websites like LeetCode, HackerRank.

 * Data Analysis & Visualization:

 1. Data Cleaning: We could take a dataset and clean it by removing missing
    values, handling outliers, encoding variables, etc.
 2. Data Visualization: We could explore a dataset and create various
    visualizations (like line graphs, bar plots, histograms, etc.) to understand
    the data better.
 3. Statistical Analysis: We could perform statistical analysis on a dataset of
    your choice.
 4. Machine Learning: We could implement a simple machine learning model on a
    dataset. We can even go through a step-by-step process of how machine
    learning models are built and refined.
 5. Data Scraping: If you’re interested, we could write a script to scrape data
    from the web.

 * External Services & APIs:

 1. API Calls: We could write a script to interact with an API of your choice,
    perhaps fetching and displaying data from it.
 2. Database Interactions: We could write SQL queries to interact with a
    database, if you have one set up.
 3. Email Automation: We could write a script to automate emails, such as
    sending an email to multiple recipients.
 4. Web Scraping: If there’s a website with data you’re interested in, we could
    write a script to scrape data from it.
 5. Task Automation: We can script regular system tasks that could make your
    day-to-day activities easier.

 * Design & Multimedia:

 1. Website Design: We could start a plan to design a simple website using HTML,
    CSS, and JavaScript.
 2. Photo Editing: Basic photo editing tasks can be done using Python libraries
    like PIL or OpenCV.
 3. Video Processing: We could write scripts for basic video processing tasks
    using Python’s moviepy library.
 4. Creating Animations: We can create basic animations using JavaScript or CSS.
 5. Designing a User Interface: We could design a simple user interface for an
    application.

 * Network-Related Tasks:

 1. Network Ping Check: We could write a script to check the network
    connectivity to a list of hosts.
 2. Port Scanning: Writing a basic port scanning script.
 3. Traffic Monitoring: We could monitor network traffic on your system.
 4. DNS Lookup: A script to perform a DNS lookup of a particular URL.
 5. Checking Internet Speed: We can check your internet upload and download
    speed.

 * System Diagnostics & Performance:

 1. Performance Monitoring: Write a script to monitor the performance of your
    machine.
 2. Check System Logs: Write a script to fetch and examine system logs.
 3. Hardware Statistics: Gather statistics on your computer’s hardware (CPU
    usage, memory usage, etc.)
 4. Network Monitoring: Monitor network usage and statistics.
 5. Detect Application Errors: We can write scripts that detect errors,
    exceptions, or specific log entries related to the application’s behavior.

 * Interactive Tasks:

 1. Text-based Adventure Game: We can build a simple text-based adventure game
    in Python or another language of your choice.
 2. Interactive Quiz: We could create a quiz, on a topic of your choice.
 3. Command Line Application: Building a simple Command Line Interface (CLI)
    application.
 4. Graphical User Interface (GUI) Application: We could write a basic GUI
    application using Tkinter or similar library.
 5. Mini Game: We can develop a small, simple game like Tic Tac Toe or Rock,
    Paper, Scissors.

 * Educational Activities:

 1. Online Course Discussion: We can discuss the content of an online course
    that you’re enrolled in.
 2. Academic Paper Review: If there’s an academic paper that you’d like to
    understand better, we can go through it together.
 3. Book Notes: If there’s a particular book (technical or otherwise) that
    you’re reading, we could discuss its themes or content.
 4. Interview Preparation: I can help you with common interview questions and
    tips for the area of your interest.
 5. Learning New Skills: We can explore new skills that you’re interested in
    learning and find the most effective ways/resources for you to learn them.

 * File Operations:

 1. File Backup: We could write a script to backup certain directories or files.
 2. Duplicate Files: We could find and remove duplicate files in a directory.
 3. File Encryption: We could write a script to encrypt sensitive documents.
 4. Auto Organization: We can script to auto-organize files into appropriate
    folders based on their type.
 5. Large Files: We can find the largest files that are taking up most of the
    space.

 * Coding Practices:

 1. Code Refactoring: We could take a look at an existing piece of code and try
    to refactor it to make it more efficient, readable or maintainable.
 2. Understanding Algorithms: If there is a particular algorithm or data
    structure you would like to understand, we could go over it.
 3. Best Coding Practices: We can discuss some of the best practices in coding,
    be it naming conventions, proper commenting, or efficient ways to structure
    code.
 4. Code Debugging: If you have a code that is giving errors or not working as
    expected, we could debug it together.
 5. Set Up Development Environments: We can setup a development environment for
    a specific programming language or framework on your computer.



--------------------------------------------------------------------------------


POSTS NAVIGATION

← Newer Posts1 2 … 51 Older Posts →
 * Github Profile
 * WordPress Profile
 * Kaggle Profile


RECENT POSTS

 * OpenGPTs
 * Split and Transcribe Audio Files with OpenAI Whisper API
 * Llava Model UI Setup
 * AutoGen OSS Insight
 * pip install ollama
 * Ollama RAG
 * LangGraph Agents
 * Open Interpreter Setup
 * Open Interpreter FastAPI
 * Open Interpreter Use Cases

 * Tamil
 * Chess
 * SEO GPT

© 2024 Mervin Praison



To the top ↑ Up ↑