Comments (9)
Same for me:
client = instructor.from_litellm(completion)
completion_return = client.chat.completions.create_iterable(
messages=[{"role": "user", "content": prompt}],
response_model=task_decomp,
model=model,
)
Error: issubclass() arg 1 must be a class
class task_decomp(BaseModel):
index: int
description: str
duration: int
left: int
from instructor.
i am facing the same issue, have you figured out how to fix it?
from instructor.
will explore more!
from instructor.
This issue was fixed in #710, with the relevant changes found here:
instructor/instructor/dsl/simple_type.py
Lines 40 to 48 in 081418d
I’ve verified that the example now runs without any problems. It’s safe to close this issue.
from instructor.
I still face the same problem and the error happens like below in version 1.3.2 (latest).
issubclass() arg 1 must be a class ... TypeError: issubclass() arg 1 must be a class
![スクリーンショット 2024-06-07 3 18 43](https://private-user-images.githubusercontent.com/103740258/337387662-31e6393f-cf97-4c29-9cd6-6371d4a749c7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg2NzA4MDUsIm5iZiI6MTcxODY3MDUwNSwicGF0aCI6Ii8xMDM3NDAyNTgvMzM3Mzg3NjYyLTMxZTYzOTNmLWNmOTctNGMyOS05Y2Q2LTYzNzFkNGE3NDljNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxOFQwMDI4MjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03OTExMmZkYmYzMGRlMDNiMTI5YTdhMDg2NjIyNjdjMGIyODA1YWQ1NjBhNzI0NjE0ODM1NGE2MTAyYjdiMGQxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.LhJuB89Z5UD-1qMqDHM7_TGYirqOo7qfP-sftYroLew)
![スクリーンショット 2024-06-07 3 20 17](https://private-user-images.githubusercontent.com/103740258/337388063-995e234f-368b-4d0e-a5ae-412c3dc96d6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg2NzA4MDUsIm5iZiI6MTcxODY3MDUwNSwicGF0aCI6Ii8xMDM3NDAyNTgvMzM3Mzg4MDYzLTk5NWUyMzRmLTM2OGItNGQwZS1hNWFlLTQxMmMzZGM5NmQ2ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxOFQwMDI4MjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NTQ5NjJmMTMzMmVkYzcyYmNlYTlkOGE5NDZiYTkxYzA5Mjg5MGFkNTQ3MWNjZWU3YjVhMzJhMDdjMTZhZDY1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.dtJJj_3SMlrEFccSv8-GbZCjRrYkzZ1oIk8NCPJICDg)
class GeminiClient:
def __init__(self):
genai.configure(api_key=GOOGLE_API_KEY)
self.model = client_gemini.from_gemini(
client=genai.GenerativeModel(model_name="models/gemini-1.5-flash-latest"),
mode=Mode.GEMINI_JSON
)
class ScenarioTelop(BaseModel):
telop_id: int = Field(description="Order of the telop (starting from 1)")
overview: str = Field(description="Overview of the telop")
intention: str = Field(description="Intention of the telop")
text: str = Field(description="Corrected text of the telop")
original_text: str = Field(description="Original text of the telop")
timestamp_start: float = Field(description="Start timestamp of the telop (s)")
timestamp_end: float = Field(description="End timestamp of the telop (s)")
from instructor.
what version of python are you on?
from instructor.
what version of python are you on?
3.9.18
from instructor.
Proposed a potential fix for this #737 - can't seem to get the 3.11 coverage step to pass for some reason but the iterable fix is shown to work in 3.9,3.10 and 3.11
from instructor.
Fixed in #737
from instructor.
Related Issues (20)
- ModuleNotFoundError: No module named 'google' HOT 3
- Token usage irregularities HOT 1
- create & create_with_completion fails on non-BaseModel classes HOT 3
- 'List' response models raise exception when using create_with_completion HOT 2
- Count tokens used in retried requests due to Pydantic validation failures HOT 4
- TOOLS mode fails on retries HOT 6
- Is it possible to get the inputs that Instructor uses? HOT 1
- Failing with Ollama HOT 11
- AnthropicBedrock Tools is already out of beta HOT 1
- "Not the same number of function calls and responses" when using Mistral API
- Anthropic client is buggy HOT 1
- general way or tutorial to support any LLM provider HOT 2
- Incorrect error message in multiple tool calls assertion HOT 1
- Cannot retrieve log probabilities for generated tokens
- Manage shots for better accuracy HOT 1
- Request: Add Support for VertexAI Gemini Models in Litellm with Instructor. HOT 1
- Overload for `response_model=None` for `create(...)` HOT 3
- "Maybe" pattern spoils categorization? HOT 3
- No module named 'tenacity.asyncio' HOT 2
- Would be great if logging.INFO should show all LLM api calls, including ones made for validation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instructor.