You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
embeddings.embed_query("What is the meaning of life?")
55
62
```
56
63
64
+
### 4. Use Structured Output
65
+
`ChatOCIGenAI` supports structured output.
66
+
67
+
<sub>**Note:** The default method is`function_calling`. If default method returns `None` (e.g. for Gemini models), try`json_schema`or`json_mode`.</sub>
68
+
69
+
```python
70
+
from langchain_oci import ChatOCIGenAI
71
+
from pydantic import BaseModel
72
+
73
+
class Joke(BaseModel):
74
+
setup: str
75
+
punchline: str
76
+
77
+
llm= ChatOCIGenAI()
78
+
structured_llm= llm.with_structured_output(Joke)
79
+
structured_llm.invoke("Tell me a joke about programming")
0 commit comments