arxiv

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGoodResult = errors.New("no good search results found")
	ErrAPIResponse  = errors.New("arXiv api responded with error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client defines an HTTP client for communicating with arXiv.

func NewClient

func NewClient(topK int, userAgent string) *Client

NewClient initializes a Client with arguments for setting a max results per search query and a value for the user agent header.

func (*Client) Search

func (client *Client) Search(ctx context.Context, query string) (string, error)

Search performs a search query and returns the result as string and an error if any.

type Option

type Option func(*Options)

func WithTopk

func WithTopk(topk int) Option

func WithUserAgent

func WithUserAgent(userAgent string) Option

type Options

type Options struct {
	Topk      int
	UserAgent string
}

type Result

type Result struct {
	Title       string
	Authors     []string
	Summary     string
	PdfURL      string
	PublishedAt string
}

Result defines a search query result type.

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Tool, error)

New creates a new Arxiv Tool.

func (*Tool) Call

func (t *Tool) Call(ctx context.Context, input string) (string, error)

Call searches for papers on arXiv. Input should be a search query.

func (*Tool) Description

func (t *Tool) Description() string

Description returns the description of the tool.

func (*Tool) Name

func (t *Tool) Name() string

Name returns the name of the tool.

func (*Tool) Schema

func (t *Tool) Schema() *tool.PropertiesSchema

func (*Tool) Strict

func (t *Tool) Strict() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL