Skip to content

Instantly share code, notes, and snippets.

@davidmezzetti
Created November 8, 2024 14:34
Show Gist options
  • Save davidmezzetti/c75ec2660a697c443e11452f60578128 to your computer and use it in GitHub Desktop.
Save davidmezzetti/c75ec2660a697c443e11452f60578128 to your computer and use it in GitHub Desktop.

🤖 Agent Team 🤖

This example shows how to build an Agent having multiple agents as tools. This "Agent Team" works together to answer questions.

A more basic example can be found here

Install

pip install git+https://github.com/neuml/txtai

Define Agent

from txtai import Agent, LLM

llm = LLM("hugging-quants/Meta-Llama-3.1-8B-Instruct-AWQ-INT4")

websearcher = Agent(
    tools=["websearch"],
    llm=llm,
)

wikiman = Agent(
    tools=[{
        "name": "wikipedia",
        "description": "Searches a Wikipedia database",
        "provider": "huggingface-hub",
        "container": "neuml/txtai-wikipedia"
    }],
    llm=llm,
)

researcher = Agent(
    tools=[{
        "name": "arxiv",
        "description": "Searches a database of scientific papers",
        "provider": "huggingface-hub",
        "container": "neuml/txtai-arxiv"
    }],
    llm=llm,
)

agent = Agent(
    tools=[{
        "name": "websearcher",
        "description": "I run web searches, there is no answer a web search can't solve!",
        "target": websearcher
    }, {
        "name": "wikiman",
        "description": "Wikipedia has all the answers, I search Wikipedia and answer questions",
        "target": wikiman
    }, {
        "name": "researcher",
        "description": "I'm a science guy. I search arXiv to get all my answers.",
        "target": researcher
    }],
    llm=llm,
    max_iterations=10
)

Task the team with a job

agent("""
Work with your team and build a comprehensive report on fundamental concepts about Signal Processing.
Write the output in Markdown
""", maxlength=16000)

Report output shown below

Fundamental Concepts in Signal Processing

Signal processing is an electrical engineering subfield that focuses on analyzing, modifying and synthesizing signals, such as sound, images, potential fields, seismic signals, altimetry processing, and scientific measurements. It is used to optimize transmissions, digital storage efficiency, correct distorted signals, improve subjective video quality, and to detect or pinpoint components of interest in a measured signal.

Signal Representation

Signal representation is a fundamental concept in signal processing, which involves representing a signal in a mathematical or digital form. There are several types of signal representation, including:

Analog Signals

Analog signals are continuous-time signals that can take on any value within a given range.

Digital Signals

Digital signals are discrete-time signals that can only take on discrete values.

Continuous-Time Signals

Continuous-time signals are signals that are sampled in continuous time, such as audio signals.

Discrete-Time Signals

Discrete-time signals are signals that are sampled in discrete time, such as image signals.

Signal Sampling

Signal sampling is the process of converting a continuous-time signal into a discrete-time signal by sampling the signal at regular intervals. The sampling theorem states that a continuous-time signal can be reconstructed exactly from its samples if the sampling rate is at least twice the highest frequency component of the signal.

Fourier Transform

The Fourier transform is a mathematical formula that transforms a signal sampled in time or space to the same signal sampled in temporal or spatial frequency. It reveals important characteristics of a signal, such as its frequency components, and is a cornerstone in the analysis and representation of signals and linear, time-invariant systems.

Filter Design

Filter design is a fundamental concept in signal processing, which involves designing filters to extract specific features from a signal. There are several types of filters, including:

FIR Filters

FIR filters can be designed using windows, such as rectangular, Bartlett, Hamming, and Blackman-Harris windows.

IIR Filters

IIR filters are recursive filters that use feedback to produce a filtered signal.

Linear Algebra, Abstract Algebra, and Functional Analysis

Linear algebra, abstract algebra, and functional analysis are mathematical disciplines that are widely used in signal processing. They can be used for tasks such as approximation, optimization, parameter identification, and big data analysis.

Spectrograms, Fractal Analysis, and the Discrete Fourier Transform

Spectrograms, fractal analysis, and the discrete Fourier transform are signal processing methods that can be used for tasks such as signal decomposition, filtering, and feature extraction.

Spectrograms

Spectrograms are a type of signal representation that displays the frequency content of a signal over time.

Fractal Analysis

Fractal analysis is a type of signal analysis that can be used to extract features from a signal.

Discrete Fourier Transform

The discrete Fourier transform is a mathematical formula that transforms a discrete-time signal into its frequency domain representation.

Big Data Analysis

Big data analysis is a type of signal processing that involves analyzing large datasets to extract insights and patterns.

Conclusion

Signal processing is a fundamental discipline that is widely used in many fields, including electrical engineering, computer science, and biomedical engineering. The fundamental concepts in signal processing include signal representation, signal sampling, Fourier transform, filter design, linear algebra, abstract algebra, and functional analysis. These concepts can be used for tasks such as approximation, optimization, parameter identification, and big data analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment