Skip to content

Python: planner using Huggingface #4652

@RvTechiNNovate

Description

@RvTechiNNovate

**Describe **
i am trying to use planner using hugging face model like zypher_7b , but i am getting below error

Error
Error: ('Hugging Face completion failed', TypeError("Pipeline.call() missing 1 required positional argument: 'inputs'"), None)

Code
import regex
from semantic_kernel.planning.basic_planner import BasicPlanner
from semantic_kernel.connectors.ai.hugging_face import HuggingFaceTextCompletion
import semantic_kernel as sk
import asyncio
print("check1")

kernel = sk.Kernel()

model_name='NousResearch/Llama-2-70b-chat-hf'

huggingface=HuggingFaceTextCompletion(model_name)

print("model-loaded")

kernel.add_chat_service("huggingface",huggingface)
kernel.import_skill(sk.core_skills.MathSkill(), 'math')

planner = BasicPlanner()

ask = f"""what is the sum of 1 and 3?"""

async def fun():
plan= await planner.create_plan_async(ask,kernel)
print(plan.generated_plan)

result= await planner.execute_plan_async(plan, kernel)
print(result)

asyncio.run(fun())

Platform

  • OS: Linux
  • Language: Python]

Additional context
In Open Ai working prefect , but in huggingFace it giving error

Metadata

Metadata

Labels

bugSomething isn't workingpythonPull requests for the Python Semantic Kernel

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions