httpclient

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

httpclient implements an API client for DeepSeek's web search and fetch https://api-docs.deepseek.com/guides/search/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
}

func New

func New(apiKey string, opts ...client.ClientOpt) (*Client, error)

New returns a client for DeepSeek's web search and fetch with the API key, which is the same key as its models'. The endpoint can be replaced with client.OptEndpoint, for example for testing.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, req *FetchRequest) (FetchResponse, error)

Fetch returns the title, and the content as Markdown, of the web page with the URL in the request

func (*Client) Search

func (c *Client) Search(ctx context.Context, req *SearchRequest) (SearchResponse, error)

Search returns the results of searching the web for the query in the request

type FetchRequest

type FetchRequest struct {
	URL string `json:"url" help:"URL of the web page to fetch"`
}

FetchRequest is a request to fetch a web page

type FetchResponse

type FetchResponse struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

FetchResponse is a fetched web page, whose content is Markdown

func (FetchResponse) String

func (r FetchResponse) String() string

type SearchRequest

type SearchRequest struct {
	Query    string  `` /* 189-byte string literal not displayed */
	Count    int     `json:"count,omitempty" help:"Maximum number of results to return (1-10)" min:"1" max:"10" default:"3"`
	Question *string `` /* 158-byte string literal not displayed */
}

SearchRequest is a request to search the web

type SearchResponse

type SearchResponse struct {
	Results []SearchResult `json:"results"`
}

SearchResponse is the results of searching the web

func (SearchResponse) String

func (r SearchResponse) String() string

type SearchResult

type SearchResult struct {
	Title    string     `json:"title"`
	URL      string     `json:"url"`
	SiteName *string    `json:"site_name,omitempty"`
	Date     *time.Time `json:"date,omitempty"`
	Summary  string     `json:"summary"`
}

SearchResult is a web page which matched the search query, with a summary of it for models, and when it was published, when that's known

Jump to

Keyboard shortcuts

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