Skip to content

irthomasthomas/llm-jina-engineer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

llm-jina

PyPI Changelog License

LLM plugin for using Jina AI Search Foundation APIs

Installation

Install this plugin in the same environment as LLM.

llm install llm-jina

Usage

This plugin adds a new jina-engineer command to LLM. Before using the command, make sure to set your Jina AI API key as an environment variable:

export JINA_API_KEY=your_api_key_here

You can get your Jina AI API key for free at https://jina.ai/?sui=apikey

The jina-engineer command supports various operations:

  1. Web scraping:
llm jina-engineer --url https://example.com "Extract main content"
  1. Web search:
llm jina-engineer --search "Latest news about AI"
  1. Text classification:
llm jina-engineer --classify --labels "positive,negative,neutral" "This product is amazing!"
  1. Generate embeddings:
llm jina-engineer --embed "Embed this text"
  1. Rerank search results:
llm jina-engineer --search --rerank "Best restaurants in New York"
  1. Verify factual accuracy:
llm jina-engineer --ground "The Earth is flat"
  1. Segment text:
llm jina-engineer --segment "This is a long text that needs to be segmented into smaller chunks."

You can combine multiple operations in a single command. For example:

llm jina-engineer --search --rerank --embed "AI advancements in 2023"

Options

  • --url: Specify a URL for web scraping
  • --search: Perform a web search
  • --classify: Classify text
  • --embed: Generate embeddings
  • --rerank: Rerank search results (requires --search)
  • --ground: Verify factual accuracy
  • --segment: Segment text
  • --model: Specify the model to use for embeddings or classification (default: jina-embeddings-v3)
  • --labels: Provide labels for classification (comma-separated)

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-jina
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Contributing

Contributions to this plugin are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a new branch for your feature
  3. Make your changes and add tests
  4. Run the tests to ensure everything is working
  5. Submit a pull request

License

This plugin is released under the Apache 2.0 License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages