LLM plugin for using Jina AI Search Foundation APIs
Install this plugin in the same environment as LLM.
llm install llm-jina
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:
- Web scraping:
llm jina-engineer --url https://example.com "Extract main content"
- Web search:
llm jina-engineer --search "Latest news about AI"
- Text classification:
llm jina-engineer --classify --labels "positive,negative,neutral" "This product is amazing!"
- Generate embeddings:
llm jina-engineer --embed "Embed this text"
- Rerank search results:
llm jina-engineer --search --rerank "Best restaurants in New York"
- Verify factual accuracy:
llm jina-engineer --ground "The Earth is flat"
- 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"
--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)
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
Contributions to this plugin are welcome! Please follow these steps:
- Fork the repository
- Create a new branch for your feature
- Make your changes and add tests
- Run the tests to ensure everything is working
- Submit a pull request
This plugin is released under the Apache 2.0 License.