Skip to content

how to use ollama corectly #280

Closed
Closed
@zlonqi

Description

Excuse me. Here is my a piece of code:

    extraction_strategy = LLMExtractionStrategy(
            provider='ollama_chat/qwen2.5-coder',
            url_base="http://localhost:11434", 
            api_token=os.getenv('OPENAI_API_KEY'),
            schema=KnowledgeGraph.model_json_schema(),
            extraction_type="schema",
            instruction="""Extract entities and relationships from the given text."""
    )
        result = await crawler.arun(
            url=url,
            bypass_cache=True,
            extraction_strategy=extraction_strategy,
            # magic=True
        )

However, its execute result is as below:

Warning: Synchronous WebCrawler is not available. Install crawl4ai[sync] for synchronous support. However, please note that the synchronous version will be deprecated soon.
[LOG] 🚀 Crawl4AI 0.3.731
[LOG] 🚀 Crawling done for https://paulgraham.com/love.html, success: True, time taken: 2.72 seconds
[LOG] 🚀 Content extracted for https://paulgraham.com/love.html, success: True, time taken: 0.04 seconds
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] 🔥 Extracting semantic blocks for https://paulgraham.com/love.html, Strategy: AsyncWebCrawler
[LOG] Call LLM for https://paulgraham.com/love.html - block index: 0
[LOG] Call LLM for https://paulgraham.com/love.html - block index: 1
[LOG] Call LLM for https://paulgraham.com/love.html - block index: 2
22:23:17 - LiteLLM:INFO: utils.py:2723 -
LiteLLM completion() model= qwen2.5-coder; provider = ollama_chat
INFO:LiteLLM:
LiteLLM completion() model= qwen2.5-coder; provider = ollama_chat
22:23:17 - LiteLLM:INFO: utils.py:2723 -
LiteLLM completion() model= qwen2.5-coder; provider = ollama_chat
22:23:17 - LiteLLM:INFO: utils.py:2723 -
LiteLLM completion() model= qwen2.5-coder; provider = ollama_chat
INFO:LiteLLM:
LiteLLM completion() model= qwen2.5-coder; provider = ollama_chat
INFO:LiteLLM:
LiteLLM completion() model= qwen2.5-coder; provider = ollama_chat

yes, it seems to wait for return of program util it power off. My questions are:

  1. Ollama and LLM qwen2.5-coder are active corectly. And I can interact with they single and fluently. So How would I use ollama-llm within crawl4ai?
  2. Review from Logs, it seems create six threads or process for each calling of crawler.arun. Could I control the number of threads? (PS: I enjoy crawl4ai by pip rather than source code.)
    Thank you very much!

Activity

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

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions